Skip to content

Commit

Permalink
Merge pull request nodejs#14 from hashseed/update_v8
Browse files Browse the repository at this point in the history
Update V8 to 4c9ba86294
  • Loading branch information
hashseed committed Mar 14, 2017
2 parents f4ec76a + 8918f14 commit 1642bfd
Show file tree
Hide file tree
Showing 141 changed files with 1,648 additions and 3,145 deletions.
3 changes: 3 additions & 0 deletions deps/v8/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ config("features") {
if (v8_enable_handle_zapping) {
defines += [ "ENABLE_HANDLE_ZAPPING" ]
}
if (v8_use_snapshot) {
defines += [ "V8_USE_SNAPSHOT" ]
}
if (v8_use_external_startup_data) {
defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
}
Expand Down
5 changes: 3 additions & 2 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -6342,8 +6342,9 @@ class V8_EXPORT Isolate {
* The optional entry_hook allows the host application to provide the
* address of a function that's invoked on entry to every V8-generated
* function. Note that entry_hook is invoked at the very start of each
* generated function. Furthermore, if an entry_hook is given, V8 will
* not use a snapshot, including custom snapshots.
* generated function.
* An entry_hook can only be provided in no-snapshot builds; in snapshot
* builds it must be nullptr.
*/
FunctionEntryHook entry_hook;

Expand Down
6 changes: 6 additions & 0 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8143,6 +8143,12 @@ Isolate* Isolate::New(const Isolate::CreateParams& params) {
isolate->set_snapshot_blob(i::Snapshot::DefaultSnapshotBlob());
}
if (params.entry_hook) {
#ifdef V8_USE_SNAPSHOT
// Setting a FunctionEntryHook is only supported in no-snapshot builds.
Utils::ApiCheck(
false, "v8::Isolate::New",
"Setting a FunctionEntryHook is only supported in no-snapshot builds.");
#endif
isolate->set_function_entry_hook(params.entry_hook);
}
auto code_event_handler = params.code_event_handler;
Expand Down
14 changes: 0 additions & 14 deletions deps/v8/src/arm/macro-assembler-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2422,20 +2422,6 @@ void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
JumpIfSmi(value, miss);
}


void MacroAssembler::GetMapConstructor(Register result, Register map,
Register temp, Register temp2) {
Label done, loop;
ldr(result, FieldMemOperand(map, Map::kConstructorOrBackPointerOffset));
bind(&loop);
JumpIfSmi(result, &done);
CompareObjectType(result, temp, temp2, MAP_TYPE);
b(ne, &done);
ldr(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset));
b(&loop);
bind(&done);
}

void MacroAssembler::CallStub(CodeStub* stub,
TypeFeedbackId ast_id,
Condition cond) {
Expand Down
5 changes: 0 additions & 5 deletions deps/v8/src/arm/macro-assembler-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -824,11 +824,6 @@ class MacroAssembler: public Assembler {
// ---------------------------------------------------------------------------
// Support functions.

// Machine code version of Map::GetConstructor().
// |temp| holds |result|'s map when done, and |temp2| its instance type.
void GetMapConstructor(Register result, Register map, Register temp,
Register temp2);

// Compare object type for heap object. heap_object contains a non-Smi
// whose object type should be compared with the given type. This both
// sets the flags and leaves the object type in the type_reg register.
Expand Down
13 changes: 0 additions & 13 deletions deps/v8/src/arm64/macro-assembler-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3385,19 +3385,6 @@ void MacroAssembler::LoadElementsKindFromMap(Register result, Register map) {
}


void MacroAssembler::GetMapConstructor(Register result, Register map,
Register temp, Register temp2) {
Label done, loop;
Ldr(result, FieldMemOperand(map, Map::kConstructorOrBackPointerOffset));
Bind(&loop);
JumpIfSmi(result, &done);
CompareObjectType(result, temp, temp2, MAP_TYPE);
B(ne, &done);
Ldr(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset));
B(&loop);
Bind(&done);
}

void MacroAssembler::PushRoot(Heap::RootListIndex index) {
UseScratchRegisterScope temps(this);
Register temp = temps.AcquireX();
Expand Down
5 changes: 0 additions & 5 deletions deps/v8/src/arm64/macro-assembler-arm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -1363,11 +1363,6 @@ class MacroAssembler : public Assembler {
// ---------------------------------------------------------------------------
// Support functions.

// Machine code version of Map::GetConstructor().
// |temp| holds |result|'s map when done, and |temp2| its instance type.
void GetMapConstructor(Register result, Register map, Register temp,
Register temp2);

// Compare object type for heap object. heap_object contains a non-Smi
// whose object type should be compared with the given type. This both
// sets the flags and leaves the object type in the type_reg register.
Expand Down
1 change: 0 additions & 1 deletion deps/v8/src/ast/ast-types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ AstType::bitset AstBitsetType::Lub(i::Map* map) {
if (map == heap->boolean_map()) return kBoolean;
if (map == heap->the_hole_map()) return kHole;
DCHECK(map == heap->uninitialized_map() ||
map == heap->no_interceptor_result_sentinel_map() ||
map == heap->termination_exception_map() ||
map == heap->arguments_marker_map() ||
map == heap->optimized_out_map() ||
Expand Down
30 changes: 24 additions & 6 deletions deps/v8/src/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,16 @@ bool GetOptimizedCodeLater(CompilationJob* job) {
CompilationInfo* info = job->info();
Isolate* isolate = info->isolate();

if (FLAG_mark_optimizing_shared_functions &&
info->closure()->shared()->has_concurrent_optimization_job()) {
if (FLAG_trace_concurrent_recompilation) {
PrintF(" ** Compilation job already running for ");
info->shared_info()->ShortPrint();
PrintF(".\n");
}
return false;
}

if (!isolate->optimizing_compile_dispatcher()->IsQueueAvailable()) {
if (FLAG_trace_concurrent_recompilation) {
PrintF(" ** Compilation queue full, will retry optimizing ");
Expand Down Expand Up @@ -793,6 +803,7 @@ bool GetOptimizedCodeLater(CompilationJob* job) {

if (job->PrepareJob() != CompilationJob::SUCCEEDED) return false;
isolate->optimizing_compile_dispatcher()->QueueForOptimization(job);
info->closure()->shared()->set_has_concurrent_optimization_job(true);

if (FLAG_trace_concurrent_recompilation) {
PrintF(" ** Queued ");
Expand All @@ -813,9 +824,6 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
DCHECK_IMPLIES(ignition_osr, !osr_ast_id.IsNone());
DCHECK_IMPLIES(ignition_osr, FLAG_ignition_osr);

// Shared function no longer needs to be tiered up
shared->set_marked_for_tier_up(false);

Handle<Code> cached_code;
// TODO(4764): When compiling for OSR from bytecode, BailoutId might derive
// from bytecode offset and overlap with actual BailoutId. No lookup!
Expand Down Expand Up @@ -928,6 +936,13 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
return MaybeHandle<Code>();
}

MaybeHandle<Code> GetOptimizedCodeMaybeLater(Handle<JSFunction> function) {
Isolate* isolate = function->GetIsolate();
return GetOptimizedCode(function, isolate->concurrent_recompilation_enabled()
? Compiler::CONCURRENT
: Compiler::NOT_CONCURRENT);
}

CompilationJob::Status FinalizeOptimizedCompilationJob(CompilationJob* job) {
CompilationInfo* info = job->info();
Isolate* isolate = info->isolate();
Expand All @@ -947,6 +962,11 @@ CompilationJob::Status FinalizeOptimizedCompilationJob(CompilationJob* job) {
shared->set_profiler_ticks(0);
}

shared->set_has_concurrent_optimization_job(false);

// Shared function no longer needs to be tiered up.
shared->set_marked_for_tier_up(false);

DCHECK(!shared->HasDebugInfo());

// 1) Optimization on the concurrent thread may have failed.
Expand Down Expand Up @@ -1094,9 +1114,7 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
}

Handle<Code> code;
// TODO(leszeks): Look into performing this compilation concurrently.
if (GetOptimizedCode(function, Compiler::NOT_CONCURRENT)
.ToHandle(&code)) {
if (GetOptimizedCodeMaybeLater(function).ToHandle(&code)) {
return code;
}
break;
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/compiler/OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ mstarzinger@chromium.org
mtrofin@chromium.org
titzer@chromium.org
danno@chromium.org
tebbi@chromium.org

per-file wasm-*=ahaas@chromium.org
per-file wasm-*=clemensh@chromium.org
1 change: 0 additions & 1 deletion deps/v8/src/compiler/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ Type::bitset BitsetType::Lub(i::Map* map) {
if (map == heap->boolean_map()) return kBoolean;
if (map == heap->the_hole_map()) return kHole;
DCHECK(map == heap->uninitialized_map() ||
map == heap->no_interceptor_result_sentinel_map() ||
map == heap->termination_exception_map() ||
map == heap->arguments_marker_map() ||
map == heap->optimized_out_map() ||
Expand Down
7 changes: 0 additions & 7 deletions deps/v8/src/compiler/wasm-compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4099,13 +4099,6 @@ SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction(
func_index_ < FLAG_trace_wasm_ast_end) {
PrintRawWasmCode(isolate_->allocator(), func_body_, module_env_->module);
}
// TODO(clemens): Remove the trace_wasm_text_start flag.
// if (func_index_ >= FLAG_trace_wasm_text_start && func_index_ <
// FLAG_trace_wasm_text_end) {
// OFStream os(stdout);
// PrintWasmText(module_env_.module, module_env_->wire_bytes,
// function_->func_index, os, nullptr);
//}
if (FLAG_trace_wasm_decode_time) {
*decode_ms = decode_timer.Elapsed().InMillisecondsF();
}
Expand Down
4 changes: 3 additions & 1 deletion deps/v8/src/counters.h
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,9 @@ class RuntimeCallTimer final {
V(LoadIC_LoadFieldFromPrototypeDH) \
V(LoadIC_LoadField) \
V(LoadIC_LoadGlobal) \
V(LoadIC_LoadInterceptor) \
V(LoadIC_LoadInterceptorDH) \
V(LoadIC_LoadNonMaskingInterceptorDH) \
V(LoadIC_LoadInterceptorFromPrototypeDH) \
V(LoadIC_LoadNonexistentDH) \
V(LoadIC_LoadNonexistent) \
V(LoadIC_LoadNormalDH) \
Expand Down
18 changes: 0 additions & 18 deletions deps/v8/src/crankshaft/arm/lithium-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,6 @@ void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) {
stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
}

void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if class_of_test(");
value()->PrintTo(stream);
stream->Add(", \"%o\") then B%d else B%d",
*hydrogen()->class_name(),
true_block_id(),
false_block_id());
}


void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if typeof ");
value()->PrintTo(stream);
Expand Down Expand Up @@ -1718,14 +1708,6 @@ LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch(
return new(zone()) LHasInstanceTypeAndBranch(value);
}

LInstruction* LChunkBuilder::DoClassOfTestAndBranch(
HClassOfTestAndBranch* instr) {
DCHECK(instr->value()->representation().IsTagged());
LOperand* value = UseRegister(instr->value());
return new(zone()) LClassOfTestAndBranch(value, TempRegister());
}


LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) {
LOperand* string = UseRegisterAtStart(instr->string());
LOperand* index = UseRegisterOrConstantAtStart(instr->index());
Expand Down
19 changes: 0 additions & 19 deletions deps/v8/src/crankshaft/arm/lithium-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class LCodeGen;
V(ClampDToUint8) \
V(ClampIToUint8) \
V(ClampTToUint8) \
V(ClassOfTestAndBranch) \
V(CompareNumericAndBranch) \
V(CmpObjectEqAndBranch) \
V(CmpHoleAndBranch) \
Expand Down Expand Up @@ -1066,24 +1065,6 @@ class LHasInstanceTypeAndBranch final : public LControlInstruction<1, 0> {
};


class LClassOfTestAndBranch final : public LControlInstruction<1, 1> {
public:
LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
inputs_[0] = value;
temps_[0] = temp;
}

LOperand* value() { return inputs_[0]; }
LOperand* temp() { return temps_[0]; }

DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
"class-of-test-and-branch")
DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)

void PrintDataTo(StringStream* stream) override;
};


class LCmpT final : public LTemplateInstruction<1, 3, 0> {
public:
LCmpT(LOperand* context, LOperand* left, LOperand* right) {
Expand Down
63 changes: 0 additions & 63 deletions deps/v8/src/crankshaft/arm/lithium-codegen-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2391,69 +2391,6 @@ void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
EmitBranch(instr, BranchCondition(instr->hydrogen()));
}

// Branches to a label or falls through with the answer in flags. Trashes
// the temp registers, but not the input.
void LCodeGen::EmitClassOfTest(Label* is_true,
Label* is_false,
Handle<String>class_name,
Register input,
Register temp,
Register temp2) {
DCHECK(!input.is(temp));
DCHECK(!input.is(temp2));
DCHECK(!temp.is(temp2));

__ JumpIfSmi(input, is_false);

__ CompareObjectType(input, temp, temp2, FIRST_FUNCTION_TYPE);
STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE);
if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
__ b(hs, is_true);
} else {
__ b(hs, is_false);
}

// Check if the constructor in the map is a function.
Register instance_type = ip;
__ GetMapConstructor(temp, temp, temp2, instance_type);

// Objects with a non-function constructor have class 'Object'.
__ cmp(instance_type, Operand(JS_FUNCTION_TYPE));
if (String::Equals(isolate()->factory()->Object_string(), class_name)) {
__ b(ne, is_true);
} else {
__ b(ne, is_false);
}

// temp now contains the constructor function. Grab the
// instance class name from there.
__ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset));
__ ldr(temp, FieldMemOperand(temp,
SharedFunctionInfo::kInstanceClassNameOffset));
// The class name we are testing against is internalized since it's a literal.
// The name in the constructor is internalized because of the way the context
// is booted. This routine isn't expected to work for random API-created
// classes and it doesn't have to because you can't access it with natives
// syntax. Since both sides are internalized it is sufficient to use an
// identity comparison.
__ cmp(temp, Operand(class_name));
// End with the answer in flags.
}


void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
Register input = ToRegister(instr->value());
Register temp = scratch0();
Register temp2 = ToRegister(instr->temp());
Handle<String> class_name = instr->hydrogen()->class_name();

EmitClassOfTest(instr->TrueLabel(chunk_), instr->FalseLabel(chunk_),
class_name, input, temp, temp2);

EmitBranch(instr, eq);
}


void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
Register reg = ToRegister(instr->value());
Register temp = ToRegister(instr->temp());
Expand Down
7 changes: 0 additions & 7 deletions deps/v8/src/crankshaft/arm/lithium-codegen-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,6 @@ class LCodeGen: public LCodeGenBase {

LInstruction* GetNextInstruction();

void EmitClassOfTest(Label* if_true,
Label* if_false,
Handle<String> class_name,
Register input,
Register temporary,
Register temporary2);

bool HasAllocatedStackSlots() const {
return chunk()->HasAllocatedStackSlots();
}
Expand Down

0 comments on commit 1642bfd

Please sign in to comment.