Skip to content

Commit dbdcded

Browse files
committed
deps: upgrade to V8 5.0.71.54
PR-URL: #7531 Reviewed-By: Michaël Zasso <[email protected]>
1 parent ba1c7ad commit dbdcded

18 files changed

+657
-155
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 5
1212
#define V8_MINOR_VERSION 0
1313
#define V8_BUILD_NUMBER 71
14-
#define V8_PATCH_LEVEL 52
14+
#define V8_PATCH_LEVEL 54
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/bootstrapper.cc

+4
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
12921292
attribs);
12931293
string_map->AppendDescriptor(&d);
12941294
}
1295+
1296+
// Install the String.fromCharCode function.
1297+
SimpleInstallFunction(string_fun, "fromCharCode",
1298+
Builtins::kStringFromCharCode, 1, false);
12951299
}
12961300

12971301
{

deps/v8/src/builtins.cc

+68
Original file line numberDiff line numberDiff line change
@@ -3732,6 +3732,74 @@ BUILTIN(ObjectProtoToString) {
37323732
return *result;
37333733
}
37343734

3735+
// -----------------------------------------------------------------------------
3736+
// ES6 section 21.1 String Objects
3737+
3738+
namespace {
3739+
3740+
bool ToUint16(Handle<Object> value, uint16_t* result) {
3741+
if (value->IsNumber() || Object::ToNumber(value).ToHandle(&value)) {
3742+
*result = DoubleToUint32(value->Number());
3743+
return true;
3744+
}
3745+
return false;
3746+
}
3747+
3748+
} // namespace
3749+
3750+
// ES6 21.1.2.1 String.fromCharCode ( ...codeUnits )
3751+
BUILTIN(StringFromCharCode) {
3752+
HandleScope scope(isolate);
3753+
// Check resulting string length.
3754+
int index = 0;
3755+
Handle<String> result;
3756+
int const length = args.length() - 1;
3757+
if (length == 0) return isolate->heap()->empty_string();
3758+
DCHECK_LT(0, length);
3759+
// Load the first character code.
3760+
uint16_t code;
3761+
if (!ToUint16(args.at<Object>(1), &code)) return isolate->heap()->exception();
3762+
// Assume that the resulting String contains only one byte characters.
3763+
if (code <= String::kMaxOneByteCharCodeU) {
3764+
// Check for single one-byte character fast case.
3765+
if (length == 1) {
3766+
return *isolate->factory()->LookupSingleCharacterStringFromCode(code);
3767+
}
3768+
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
3769+
isolate, result, isolate->factory()->NewRawOneByteString(length));
3770+
do {
3771+
Handle<SeqOneByteString>::cast(result)->Set(index, code);
3772+
if (++index == length) break;
3773+
if (!ToUint16(args.at<Object>(1 + index), &code)) {
3774+
return isolate->heap()->exception();
3775+
}
3776+
} while (code <= String::kMaxOneByteCharCodeU);
3777+
}
3778+
// Check if all characters fit into the one byte range.
3779+
if (index < length) {
3780+
// Fallback to two byte string.
3781+
Handle<String> new_result;
3782+
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
3783+
isolate, new_result, isolate->factory()->NewRawTwoByteString(length));
3784+
for (int new_index = 0; new_index < index; ++new_index) {
3785+
uint16_t new_code =
3786+
Handle<SeqOneByteString>::cast(result)->Get(new_index);
3787+
Handle<SeqTwoByteString>::cast(new_result)->Set(new_index, new_code);
3788+
}
3789+
while (true) {
3790+
Handle<SeqTwoByteString>::cast(new_result)->Set(index, code);
3791+
if (++index == length) break;
3792+
if (!ToUint16(args.at<Object>(1 + index), &code)) {
3793+
return isolate->heap()->exception();
3794+
}
3795+
}
3796+
result = new_result;
3797+
}
3798+
return *result;
3799+
}
3800+
3801+
// -----------------------------------------------------------------------------
3802+
// ES6 section 21.1 ArrayBuffer Objects
37353803

37363804
// ES6 section 24.1.2.1 ArrayBuffer ( length ) for the [[Call]] case.
37373805
BUILTIN(ArrayBufferConstructor) {

deps/v8/src/builtins.h

+2
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ inline bool operator&(BuiltinExtraArguments lhs, BuiltinExtraArguments rhs) {
149149
V(ReflectSet, kNone) \
150150
V(ReflectSetPrototypeOf, kNone) \
151151
\
152+
V(StringFromCharCode, kNone) \
153+
\
152154
V(SymbolConstructor, kNone) \
153155
V(SymbolConstructor_ConstructStub, kTarget) \
154156
\

deps/v8/src/compiler/access-info.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ bool AccessInfoFactory::ComputeElementAccessInfos(
192192
MapTransitionList transitions(maps.length());
193193
for (Handle<Map> map : maps) {
194194
if (Map::TryUpdate(map).ToHandle(&map)) {
195-
Handle<Map> transition_target =
196-
Map::FindTransitionedMap(map, &possible_transition_targets);
197-
if (transition_target.is_null()) {
195+
Map* transition_target =
196+
map->FindElementsKindTransitionedMap(&possible_transition_targets);
197+
if (transition_target == nullptr) {
198198
receiver_maps.Add(map);
199199
} else {
200-
transitions.push_back(std::make_pair(map, transition_target));
200+
transitions.push_back(std::make_pair(map, handle(transition_target)));
201201
}
202202
}
203203
}

deps/v8/src/crankshaft/hydrogen.cc

+7-3
Original file line numberDiff line numberDiff line change
@@ -7600,9 +7600,13 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
76007600
// Get transition target for each map (NULL == no transition).
76017601
for (int i = 0; i < maps->length(); ++i) {
76027602
Handle<Map> map = maps->at(i);
7603-
Handle<Map> transitioned_map =
7604-
Map::FindTransitionedMap(map, &possible_transitioned_maps);
7605-
transition_target.Add(transitioned_map);
7603+
Map* transitioned_map =
7604+
map->FindElementsKindTransitionedMap(&possible_transitioned_maps);
7605+
if (transitioned_map != nullptr) {
7606+
transition_target.Add(handle(transitioned_map));
7607+
} else {
7608+
transition_target.Add(Handle<Map>());
7609+
}
76067610
}
76077611

76087612
MapHandleList untransitionable_maps(maps->length());

deps/v8/src/ic/ic-compiler.cc

+5-2
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,11 @@ void PropertyICCompiler::CompileKeyedStorePolymorphicHandlers(
235235
for (int i = 0; i < receiver_maps->length(); ++i) {
236236
Handle<Map> receiver_map(receiver_maps->at(i));
237237
Handle<Code> cached_stub;
238-
Handle<Map> transitioned_map =
239-
Map::FindTransitionedMap(receiver_map, receiver_maps);
238+
Handle<Map> transitioned_map;
239+
{
240+
Map* tmap = receiver_map->FindElementsKindTransitionedMap(receiver_maps);
241+
if (tmap != nullptr) transitioned_map = handle(tmap);
242+
}
240243

241244
// TODO(mvstanton): The code below is doing pessimistic elements
242245
// transitions. I would like to stop doing that and rely on Allocation Site

deps/v8/src/ic/ic.cc

+6-5
Original file line numberDiff line numberDiff line change
@@ -836,11 +836,12 @@ bool IC::IsTransitionOfMonomorphicTarget(Map* source_map, Map* target_map) {
836836
ElementsKind target_elements_kind = target_map->elements_kind();
837837
bool more_general_transition = IsMoreGeneralElementsKindTransition(
838838
source_map->elements_kind(), target_elements_kind);
839-
Map* transitioned_map =
840-
more_general_transition
841-
? source_map->LookupElementsTransitionMap(target_elements_kind)
842-
: NULL;
843-
839+
Map* transitioned_map = nullptr;
840+
if (more_general_transition) {
841+
MapHandleList map_list;
842+
map_list.Add(handle(target_map));
843+
transitioned_map = source_map->FindElementsKindTransitionedMap(&map_list);
844+
}
844845
return transitioned_map == target_map;
845846
}
846847

deps/v8/src/js/string.js

-13
Original file line numberDiff line numberDiff line change
@@ -558,18 +558,6 @@ function StringTrimRight() {
558558
}
559559

560560

561-
// ECMA-262, section 15.5.3.2
562-
function StringFromCharCode(_) { // length == 1
563-
"use strict";
564-
var s = "";
565-
var n = arguments.length;
566-
for (var i = 0; i < n; ++i) {
567-
s += %_StringCharFromCode(arguments[i] & 0xffff);
568-
}
569-
return s;
570-
}
571-
572-
573561
// ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1
574562
function HtmlEscape(str) {
575563
return %_Call(StringReplace, TO_STRING(str), /"/g, "&quot;");
@@ -860,7 +848,6 @@ function StringRaw(callSite) {
860848

861849
// Set up the non-enumerable functions on the String object.
862850
utils.InstallFunctions(GlobalString, DONT_ENUM, [
863-
"fromCharCode", StringFromCharCode,
864851
"fromCodePoint", StringFromCodePoint,
865852
"raw", StringRaw
866853
]);

deps/v8/src/objects-inl.h

+20
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "src/conversions-inl.h"
1919
#include "src/factory.h"
2020
#include "src/field-index-inl.h"
21+
#include "src/field-type.h"
2122
#include "src/handles-inl.h"
2223
#include "src/heap/heap-inl.h"
2324
#include "src/heap/heap.h"
@@ -2724,6 +2725,25 @@ FixedArrayBase* Map::GetInitialElements() {
27242725
return NULL;
27252726
}
27262727

2728+
// static
2729+
Handle<Map> Map::ReconfigureProperty(Handle<Map> map, int modify_index,
2730+
PropertyKind new_kind,
2731+
PropertyAttributes new_attributes,
2732+
Representation new_representation,
2733+
Handle<FieldType> new_field_type,
2734+
StoreMode store_mode) {
2735+
return Reconfigure(map, map->elements_kind(), modify_index, new_kind,
2736+
new_attributes, new_representation, new_field_type,
2737+
store_mode);
2738+
}
2739+
2740+
// static
2741+
Handle<Map> Map::ReconfigureElementsKind(Handle<Map> map,
2742+
ElementsKind new_elements_kind) {
2743+
return Reconfigure(map, new_elements_kind, -1, kData, NONE,
2744+
Representation::None(), FieldType::None(map->GetIsolate()),
2745+
ALLOW_IN_DESCRIPTOR);
2746+
}
27272747

27282748
Object** DescriptorArray::GetKeySlot(int descriptor_number) {
27292749
DCHECK(descriptor_number < number_of_descriptors());

0 commit comments

Comments
 (0)