Skip to content

Commit

Permalink
deps: upgrade to V8 5.0.71.54
Browse files Browse the repository at this point in the history
PR-URL: #7531
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
  • Loading branch information
bnoordhuis committed Jul 9, 2016
1 parent ba1c7ad commit dbdcded
Show file tree
Hide file tree
Showing 18 changed files with 657 additions and 155 deletions.
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 0
#define V8_BUILD_NUMBER 71
#define V8_PATCH_LEVEL 52
#define V8_PATCH_LEVEL 54

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/bootstrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
attribs);
string_map->AppendDescriptor(&d);
}

// Install the String.fromCharCode function.
SimpleInstallFunction(string_fun, "fromCharCode",
Builtins::kStringFromCharCode, 1, false);
}

{
Expand Down
68 changes: 68 additions & 0 deletions deps/v8/src/builtins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3732,6 +3732,74 @@ BUILTIN(ObjectProtoToString) {
return *result;
}

// -----------------------------------------------------------------------------
// ES6 section 21.1 String Objects

namespace {

bool ToUint16(Handle<Object> value, uint16_t* result) {
if (value->IsNumber() || Object::ToNumber(value).ToHandle(&value)) {
*result = DoubleToUint32(value->Number());
return true;
}
return false;
}

} // namespace

// ES6 21.1.2.1 String.fromCharCode ( ...codeUnits )
BUILTIN(StringFromCharCode) {
HandleScope scope(isolate);
// Check resulting string length.
int index = 0;
Handle<String> result;
int const length = args.length() - 1;
if (length == 0) return isolate->heap()->empty_string();
DCHECK_LT(0, length);
// Load the first character code.
uint16_t code;
if (!ToUint16(args.at<Object>(1), &code)) return isolate->heap()->exception();
// Assume that the resulting String contains only one byte characters.
if (code <= String::kMaxOneByteCharCodeU) {
// Check for single one-byte character fast case.
if (length == 1) {
return *isolate->factory()->LookupSingleCharacterStringFromCode(code);
}
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, isolate->factory()->NewRawOneByteString(length));
do {
Handle<SeqOneByteString>::cast(result)->Set(index, code);
if (++index == length) break;
if (!ToUint16(args.at<Object>(1 + index), &code)) {
return isolate->heap()->exception();
}
} while (code <= String::kMaxOneByteCharCodeU);
}
// Check if all characters fit into the one byte range.
if (index < length) {
// Fallback to two byte string.
Handle<String> new_result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, new_result, isolate->factory()->NewRawTwoByteString(length));
for (int new_index = 0; new_index < index; ++new_index) {
uint16_t new_code =
Handle<SeqOneByteString>::cast(result)->Get(new_index);
Handle<SeqTwoByteString>::cast(new_result)->Set(new_index, new_code);
}
while (true) {
Handle<SeqTwoByteString>::cast(new_result)->Set(index, code);
if (++index == length) break;
if (!ToUint16(args.at<Object>(1 + index), &code)) {
return isolate->heap()->exception();
}
}
result = new_result;
}
return *result;
}

// -----------------------------------------------------------------------------
// ES6 section 21.1 ArrayBuffer Objects

// ES6 section 24.1.2.1 ArrayBuffer ( length ) for the [[Call]] case.
BUILTIN(ArrayBufferConstructor) {
Expand Down
2 changes: 2 additions & 0 deletions deps/v8/src/builtins.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ inline bool operator&(BuiltinExtraArguments lhs, BuiltinExtraArguments rhs) {
V(ReflectSet, kNone) \
V(ReflectSetPrototypeOf, kNone) \
\
V(StringFromCharCode, kNone) \
\
V(SymbolConstructor, kNone) \
V(SymbolConstructor_ConstructStub, kTarget) \
\
Expand Down
8 changes: 4 additions & 4 deletions deps/v8/src/compiler/access-info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ bool AccessInfoFactory::ComputeElementAccessInfos(
MapTransitionList transitions(maps.length());
for (Handle<Map> map : maps) {
if (Map::TryUpdate(map).ToHandle(&map)) {
Handle<Map> transition_target =
Map::FindTransitionedMap(map, &possible_transition_targets);
if (transition_target.is_null()) {
Map* transition_target =
map->FindElementsKindTransitionedMap(&possible_transition_targets);
if (transition_target == nullptr) {
receiver_maps.Add(map);
} else {
transitions.push_back(std::make_pair(map, transition_target));
transitions.push_back(std::make_pair(map, handle(transition_target)));
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions deps/v8/src/crankshaft/hydrogen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7600,9 +7600,13 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
// Get transition target for each map (NULL == no transition).
for (int i = 0; i < maps->length(); ++i) {
Handle<Map> map = maps->at(i);
Handle<Map> transitioned_map =
Map::FindTransitionedMap(map, &possible_transitioned_maps);
transition_target.Add(transitioned_map);
Map* transitioned_map =
map->FindElementsKindTransitionedMap(&possible_transitioned_maps);
if (transitioned_map != nullptr) {
transition_target.Add(handle(transitioned_map));
} else {
transition_target.Add(Handle<Map>());
}
}

MapHandleList untransitionable_maps(maps->length());
Expand Down
7 changes: 5 additions & 2 deletions deps/v8/src/ic/ic-compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,11 @@ void PropertyICCompiler::CompileKeyedStorePolymorphicHandlers(
for (int i = 0; i < receiver_maps->length(); ++i) {
Handle<Map> receiver_map(receiver_maps->at(i));
Handle<Code> cached_stub;
Handle<Map> transitioned_map =
Map::FindTransitionedMap(receiver_map, receiver_maps);
Handle<Map> transitioned_map;
{
Map* tmap = receiver_map->FindElementsKindTransitionedMap(receiver_maps);
if (tmap != nullptr) transitioned_map = handle(tmap);
}

// TODO(mvstanton): The code below is doing pessimistic elements
// transitions. I would like to stop doing that and rely on Allocation Site
Expand Down
11 changes: 6 additions & 5 deletions deps/v8/src/ic/ic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -836,11 +836,12 @@ bool IC::IsTransitionOfMonomorphicTarget(Map* source_map, Map* target_map) {
ElementsKind target_elements_kind = target_map->elements_kind();
bool more_general_transition = IsMoreGeneralElementsKindTransition(
source_map->elements_kind(), target_elements_kind);
Map* transitioned_map =
more_general_transition
? source_map->LookupElementsTransitionMap(target_elements_kind)
: NULL;

Map* transitioned_map = nullptr;
if (more_general_transition) {
MapHandleList map_list;
map_list.Add(handle(target_map));
transitioned_map = source_map->FindElementsKindTransitionedMap(&map_list);
}
return transitioned_map == target_map;
}

Expand Down
13 changes: 0 additions & 13 deletions deps/v8/src/js/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,18 +558,6 @@ function StringTrimRight() {
}


// ECMA-262, section 15.5.3.2
function StringFromCharCode(_) { // length == 1
"use strict";
var s = "";
var n = arguments.length;
for (var i = 0; i < n; ++i) {
s += %_StringCharFromCode(arguments[i] & 0xffff);
}
return s;
}


// ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1
function HtmlEscape(str) {
return %_Call(StringReplace, TO_STRING(str), /"/g, "&quot;");
Expand Down Expand Up @@ -860,7 +848,6 @@ function StringRaw(callSite) {

// Set up the non-enumerable functions on the String object.
utils.InstallFunctions(GlobalString, DONT_ENUM, [
"fromCharCode", StringFromCharCode,
"fromCodePoint", StringFromCodePoint,
"raw", StringRaw
]);
Expand Down
20 changes: 20 additions & 0 deletions deps/v8/src/objects-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "src/conversions-inl.h"
#include "src/factory.h"
#include "src/field-index-inl.h"
#include "src/field-type.h"
#include "src/handles-inl.h"
#include "src/heap/heap-inl.h"
#include "src/heap/heap.h"
Expand Down Expand Up @@ -2724,6 +2725,25 @@ FixedArrayBase* Map::GetInitialElements() {
return NULL;
}

// static
Handle<Map> Map::ReconfigureProperty(Handle<Map> map, int modify_index,
PropertyKind new_kind,
PropertyAttributes new_attributes,
Representation new_representation,
Handle<FieldType> new_field_type,
StoreMode store_mode) {
return Reconfigure(map, map->elements_kind(), modify_index, new_kind,
new_attributes, new_representation, new_field_type,
store_mode);
}

// static
Handle<Map> Map::ReconfigureElementsKind(Handle<Map> map,
ElementsKind new_elements_kind) {
return Reconfigure(map, new_elements_kind, -1, kData, NONE,
Representation::None(), FieldType::None(map->GetIsolate()),
ALLOW_IN_DESCRIPTOR);
}

Object** DescriptorArray::GetKeySlot(int descriptor_number) {
DCHECK(descriptor_number < number_of_descriptors());
Expand Down
Loading

0 comments on commit dbdcded

Please sign in to comment.