From cd99870ee7e38fd0a1f4126ce9c4a20001a8b241 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Wed, 24 Apr 2013 07:39:35 +0000 Subject: [PATCH] Refactor ExternalReference::isolate_address() to not rely on Isolate::Current(). R=svenpanne@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/14429003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14400 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/code-stubs-arm.cc | 8 ++-- src/arm/deoptimizer-arm.cc | 8 ++-- src/arm/macro-assembler-arm.cc | 2 +- src/arm/regexp-macro-assembler-arm.cc | 16 +++---- src/arm/regexp-macro-assembler-arm.h | 2 + src/arm/stub-cache-arm.cc | 56 ++++++++++------------- src/assembler.cc | 4 +- src/assembler.h | 2 +- src/deoptimizer.h | 1 + src/ia32/code-stubs-ia32.cc | 8 ++-- src/ia32/deoptimizer-ia32.cc | 8 ++-- src/ia32/macro-assembler-ia32.cc | 3 +- src/ia32/regexp-macro-assembler-ia32.cc | 24 +++++----- src/ia32/regexp-macro-assembler-ia32.h | 3 ++ src/mips/code-stubs-mips.cc | 8 ++-- src/mips/deoptimizer-mips.cc | 8 ++-- src/mips/macro-assembler-mips.cc | 2 +- src/mips/regexp-macro-assembler-mips.cc | 4 +- src/mips/regexp-macro-assembler-mips.h | 1 + src/mips/stub-cache-mips.cc | 61 ++++++++++--------------- src/serialize.cc | 2 +- src/x64/code-stubs-x64.cc | 17 ++++--- src/x64/deoptimizer-x64.cc | 15 +++--- src/x64/macro-assembler-x64.cc | 4 +- src/x64/regexp-macro-assembler-x64.cc | 20 ++++---- src/x64/regexp-macro-assembler-x64.h | 2 + src/x64/stub-cache-x64.cc | 7 +-- 27 files changed, 138 insertions(+), 158 deletions(-) diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index 66bd6b55d..1f69dbe0f 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -1295,7 +1295,7 @@ void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { AllowExternalCallThatCantCauseGC scope(masm); __ PrepareCallCFunction(argument_count, fp_argument_count, scratch); - __ mov(r0, Operand(ExternalReference::isolate_address())); + __ mov(r0, Operand(ExternalReference::isolate_address(masm->isolate()))); __ CallCFunction( ExternalReference::store_buffer_overflow_function(masm->isolate()), argument_count); @@ -3102,7 +3102,7 @@ void CEntryStub::GenerateCore(MacroAssembler* masm, } #endif - __ mov(r2, Operand(ExternalReference::isolate_address())); + __ mov(r2, Operand(ExternalReference::isolate_address(isolate))); // To let the GC traverse the return address of the exit frames, we need to // know where the return address is. The CEntryStub is unmovable, so @@ -4319,7 +4319,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { // Arguments are before that on the stack or in registers. // Argument 9 (sp[20]): Pass current isolate address. - __ mov(r0, Operand(ExternalReference::isolate_address())); + __ mov(r0, Operand(ExternalReference::isolate_address(isolate))); __ str(r0, MemOperand(sp, 5 * kPointerSize)); // Argument 8 (sp[16]): Indicate that this is a direct call from JavaScript. @@ -6916,7 +6916,7 @@ void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm, Mode mode) { __ Move(address, regs_.address()); __ Move(r0, regs_.object()); __ Move(r1, address); - __ mov(r2, Operand(ExternalReference::isolate_address())); + __ mov(r2, Operand(ExternalReference::isolate_address(masm->isolate()))); AllowExternalCallThatCantCauseGC scope(masm); if (mode == INCREMENTAL_COMPACTION) { diff --git a/src/arm/deoptimizer-arm.cc b/src/arm/deoptimizer-arm.cc index 25ad85c4b..001d3c830 100644 --- a/src/arm/deoptimizer-arm.cc +++ b/src/arm/deoptimizer-arm.cc @@ -604,8 +604,6 @@ void Deoptimizer::CopyDoubleRegisters(FrameDescription* output_frame) { void Deoptimizer::EntryGenerator::Generate() { GeneratePrologue(); - Isolate* isolate = masm()->isolate(); - // Save all general purpose registers before messing with them. const int kNumberOfRegisters = Register::kNumRegisters; @@ -665,12 +663,12 @@ void Deoptimizer::EntryGenerator::Generate() { // r2: bailout id already loaded. // r3: code address or 0 already loaded. __ str(r4, MemOperand(sp, 0 * kPointerSize)); // Fp-to-sp delta. - __ mov(r5, Operand(ExternalReference::isolate_address())); + __ mov(r5, Operand(ExternalReference::isolate_address(isolate()))); __ str(r5, MemOperand(sp, 1 * kPointerSize)); // Isolate. // Call Deoptimizer::New(). { AllowExternalCallThatCantCauseGC scope(masm()); - __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6); + __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6); } // Preserve "deoptimizer" object in register r0 and get the input @@ -731,7 +729,7 @@ void Deoptimizer::EntryGenerator::Generate() { { AllowExternalCallThatCantCauseGC scope(masm()); __ CallCFunction( - ExternalReference::compute_output_frames_function(isolate), 1); + ExternalReference::compute_output_frames_function(isolate()), 1); } __ pop(r0); // Restore deoptimizer object (class Deoptimizer). diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc index cf9a6914d..bbbe52073 100644 --- a/src/arm/macro-assembler-arm.cc +++ b/src/arm/macro-assembler-arm.cc @@ -2331,7 +2331,7 @@ void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, str(r5, MemOperand(r7, kLimitOffset)); mov(r4, r0); PrepareCallCFunction(1, r5); - mov(r0, Operand(ExternalReference::isolate_address())); + mov(r0, Operand(ExternalReference::isolate_address(isolate()))); CallCFunction( ExternalReference::delete_handle_scope_extensions(isolate()), 1); mov(r0, r4); diff --git a/src/arm/regexp-macro-assembler-arm.cc b/src/arm/regexp-macro-assembler-arm.cc index 0cb80c0ac..da7afee3f 100644 --- a/src/arm/regexp-macro-assembler-arm.cc +++ b/src/arm/regexp-macro-assembler-arm.cc @@ -380,12 +380,12 @@ void RegExpMacroAssemblerARM::CheckNotBackReferenceIgnoreCase( // Address of current input position. __ add(r1, current_input_offset(), Operand(end_of_input_address())); // Isolate. - __ mov(r3, Operand(ExternalReference::isolate_address())); + __ mov(r3, Operand(ExternalReference::isolate_address(isolate()))); { AllowExternalCallThatCantCauseGC scope(masm_); ExternalReference function = - ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); + ExternalReference::re_case_insensitive_compare_uc16(isolate()); __ CallCFunction(function, argument_count); } @@ -682,7 +682,7 @@ Handle RegExpMacroAssemblerARM::GetCode(Handle source) { Label stack_ok; ExternalReference stack_limit = - ExternalReference::address_of_stack_limit(masm_->isolate()); + ExternalReference::address_of_stack_limit(isolate()); __ mov(r0, Operand(stack_limit)); __ ldr(r0, MemOperand(r0)); __ sub(r0, sp, r0, SetCC); @@ -893,9 +893,9 @@ Handle RegExpMacroAssemblerARM::GetCode(Handle source) { __ PrepareCallCFunction(num_arguments, r0); __ mov(r0, backtrack_stackpointer()); __ add(r1, frame_pointer(), Operand(kStackHighEnd)); - __ mov(r2, Operand(ExternalReference::isolate_address())); + __ mov(r2, Operand(ExternalReference::isolate_address(isolate()))); ExternalReference grow_stack = - ExternalReference::re_grow_stack(masm_->isolate()); + ExternalReference::re_grow_stack(isolate()); __ CallCFunction(grow_stack, num_arguments); // If return NULL, we have failed to grow the stack, and // must exit with a stack-overflow exception. @@ -1111,7 +1111,7 @@ void RegExpMacroAssemblerARM::CallCheckStackGuardState(Register scratch) { __ mov(r1, Operand(masm_->CodeObject())); // r0 becomes return address pointer. ExternalReference stack_guard_check = - ExternalReference::re_check_stack_guard_state(masm_->isolate()); + ExternalReference::re_check_stack_guard_state(isolate()); CallCFunctionUsingStub(stack_guard_check, num_arguments); } @@ -1292,7 +1292,7 @@ void RegExpMacroAssemblerARM::Pop(Register target) { void RegExpMacroAssemblerARM::CheckPreemption() { // Check for preemption. ExternalReference stack_limit = - ExternalReference::address_of_stack_limit(masm_->isolate()); + ExternalReference::address_of_stack_limit(isolate()); __ mov(r0, Operand(stack_limit)); __ ldr(r0, MemOperand(r0)); __ cmp(sp, r0); @@ -1302,7 +1302,7 @@ void RegExpMacroAssemblerARM::CheckPreemption() { void RegExpMacroAssemblerARM::CheckStackLimit() { ExternalReference stack_limit = - ExternalReference::address_of_regexp_stack_limit(masm_->isolate()); + ExternalReference::address_of_regexp_stack_limit(isolate()); __ mov(r0, Operand(stack_limit)); __ ldr(r0, MemOperand(r0)); __ cmp(backtrack_stackpointer(), Operand(r0)); diff --git a/src/arm/regexp-macro-assembler-arm.h b/src/arm/regexp-macro-assembler-arm.h index c45669ae8..921d8f547 100644 --- a/src/arm/regexp-macro-assembler-arm.h +++ b/src/arm/regexp-macro-assembler-arm.h @@ -30,6 +30,7 @@ #include "arm/assembler-arm.h" #include "arm/assembler-arm-inl.h" +#include "macro-assembler.h" namespace v8 { namespace internal { @@ -223,6 +224,7 @@ class RegExpMacroAssemblerARM: public NativeRegExpMacroAssembler { inline void CallCFunctionUsingStub(ExternalReference function, int num_arguments); + Isolate* isolate() const { return masm_->isolate(); } MacroAssembler* masm_; diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc index 3e6eb1012..ddcbd623b 100644 --- a/src/arm/stub-cache-arm.cc +++ b/src/arm/stub-cache-arm.cc @@ -726,7 +726,7 @@ static void PushInterceptorArguments(MacroAssembler* masm, __ push(holder); __ ldr(scratch, FieldMemOperand(scratch, InterceptorInfo::kDataOffset)); __ push(scratch); - __ mov(scratch, Operand(ExternalReference::isolate_address())); + __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); __ push(scratch); } @@ -798,7 +798,7 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, } else { __ Move(r6, call_data); } - __ mov(r7, Operand(ExternalReference::isolate_address())); + __ mov(r7, Operand(ExternalReference::isolate_address(masm->isolate()))); // Store JS function, call data and isolate. __ stm(ib, sp, r5.bit() | r6.bit() | r7.bit()); @@ -1167,7 +1167,7 @@ Register StubCompiler::CheckPrototypes(Handle object, } // Log the check depth. - LOG(masm()->isolate(), IntEvent("check-maps-depth", depth + 1)); + LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) { // Check the holder map. @@ -1295,11 +1295,11 @@ void BaseLoadStubCompiler::GenerateLoadCallback( __ ldr(scratch3(), FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset)); } else { - __ Move(scratch3(), Handle(callback->data(), - callback->GetIsolate())); + __ Move(scratch3(), Handle(callback->data(), isolate())); } __ Push(reg, scratch3()); - __ mov(scratch3(), Operand(ExternalReference::isolate_address())); + __ mov(scratch3(), + Operand(ExternalReference::isolate_address(isolate()))); __ Push(scratch3(), name()); __ mov(r0, sp); // r0 = Handle @@ -1315,10 +1315,8 @@ void BaseLoadStubCompiler::GenerateLoadCallback( const int kStackUnwindSpace = 5; Address getter_address = v8::ToCData
(callback->getter()); ApiFunction fun(getter_address); - ExternalReference ref = - ExternalReference(&fun, - ExternalReference::DIRECT_GETTER_CALL, - masm()->isolate()); + ExternalReference ref = ExternalReference( + &fun, ExternalReference::DIRECT_GETTER_CALL, isolate()); __ CallApiFunctionAndReturn(ref, kStackUnwindSpace); } @@ -1406,7 +1404,7 @@ void BaseLoadStubCompiler::GenerateLoadInterceptor( ExternalReference ref = ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), - masm()->isolate()); + isolate()); __ TailCallExternalReference(ref, 6, 1); } } @@ -1716,11 +1714,10 @@ Handle CallStubCompiler::CompileArrayPushCall( __ CheckFastObjectElements(r7, r7, &call_builtin); __ bind(&no_fast_elements_check); - Isolate* isolate = masm()->isolate(); ExternalReference new_space_allocation_top = - ExternalReference::new_space_allocation_top_address(isolate); + ExternalReference::new_space_allocation_top_address(isolate()); ExternalReference new_space_allocation_limit = - ExternalReference::new_space_allocation_limit_address(isolate); + ExternalReference::new_space_allocation_limit_address(isolate()); const int kAllocationDelta = 4; // Load top and check if it is the end of elements. @@ -1759,10 +1756,8 @@ Handle CallStubCompiler::CompileArrayPushCall( __ Ret(); } __ bind(&call_builtin); - __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush, - masm()->isolate()), - argc + 1, - 1); + __ TailCallExternalReference( + ExternalReference(Builtins::c_ArrayPush, isolate()), argc + 1, 1); } // Handle call cache miss. @@ -1846,10 +1841,8 @@ Handle CallStubCompiler::CompileArrayPopCall( __ Ret(); __ bind(&call_builtin); - __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop, - masm()->isolate()), - argc + 1, - 1); + __ TailCallExternalReference( + ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); // Handle call cache miss. __ bind(&miss); @@ -2388,8 +2381,7 @@ void CallStubCompiler::CompileHandlerFrontend(Handle object, ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK); switch (check) { case RECEIVER_MAP_CHECK: - __ IncrementCounter(masm()->isolate()->counters()->call_const(), - 1, r0, r3); + __ IncrementCounter(isolate()->counters()->call_const(), 1, r0, r3); // Check that the maps haven't changed. CheckPrototypes(Handle::cast(object), r1, holder, r0, r3, r4, @@ -2579,7 +2571,7 @@ Handle CallStubCompiler::CompileCallGlobal( __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); // Jump to the cached code (tail call). - Counters* counters = masm()->isolate()->counters(); + Counters* counters = isolate()->counters(); __ IncrementCounter(counters->call_global_inline(), 1, r3, r4); ParameterCount expected(function->shared()->formal_parameter_count()); CallKind call_kind = CallICBase::Contextual::decode(extra_state_) @@ -2622,8 +2614,7 @@ Handle StoreStubCompiler::CompileStoreCallback( // Do tail-call to the runtime system. ExternalReference store_callback_property = - ExternalReference(IC_Utility(IC::kStoreCallbackProperty), - masm()->isolate()); + ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); __ TailCallExternalReference(store_callback_property, 4, 1); // Handle store cache miss. @@ -2706,8 +2697,7 @@ Handle StoreStubCompiler::CompileStoreInterceptor( // Do tail-call to the runtime system. ExternalReference store_ic_property = - ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), - masm()->isolate()); + ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); __ TailCallExternalReference(store_ic_property, 4, 1); // Handle store cache miss. @@ -2746,7 +2736,7 @@ Handle StoreStubCompiler::CompileStoreGlobal( FieldMemOperand(scratch1(), JSGlobalPropertyCell::kValueOffset)); // Cells are always rescanned, so no write barrier here. - Counters* counters = masm()->isolate()->counters(); + Counters* counters = isolate()->counters(); __ IncrementCounter( counters->named_store_global_inline(), 1, scratch1(), scratch2()); __ Ret(); @@ -2891,7 +2881,7 @@ Handle LoadStubCompiler::CompileLoadGlobal( HandlerFrontendFooter(&success, &miss); __ bind(&success); - Counters* counters = masm()->isolate()->counters(); + Counters* counters = isolate()->counters(); __ IncrementCounter(counters->named_load_global_stub(), 1, r1, r3); __ mov(r0, r4); __ Ret(); @@ -3095,7 +3085,7 @@ Handle ConstructStubCompiler::CompileConstructStub( // Remove caller arguments and receiver from the stack and return. __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2)); __ add(sp, sp, Operand(kPointerSize)); - Counters* counters = masm()->isolate()->counters(); + Counters* counters = isolate()->counters(); __ IncrementCounter(counters->constructed_objects(), 1, r1, r2); __ IncrementCounter(counters->constructed_objects_stub(), 1, r1, r2); __ Jump(lr); @@ -3103,7 +3093,7 @@ Handle ConstructStubCompiler::CompileConstructStub( // Jump to the generic stub in case the specialized code cannot handle the // construction. __ bind(&generic_stub_call); - Handle code = masm()->isolate()->builtins()->JSConstructStubGeneric(); + Handle code = isolate()->builtins()->JSConstructStubGeneric(); __ Jump(code, RelocInfo::CODE_TARGET); // Return the generated code. diff --git a/src/assembler.cc b/src/assembler.cc index 84d720b24..fff588af3 100644 --- a/src/assembler.cc +++ b/src/assembler.cc @@ -969,8 +969,8 @@ ExternalReference::ExternalReference(const Runtime::Function* f, : address_(Redirect(isolate, f->entry)) {} -ExternalReference ExternalReference::isolate_address() { - return ExternalReference(Isolate::Current()); +ExternalReference ExternalReference::isolate_address(Isolate* isolate) { + return ExternalReference(isolate); } diff --git a/src/assembler.h b/src/assembler.h index 381ae0a80..932376798 100644 --- a/src/assembler.h +++ b/src/assembler.h @@ -681,7 +681,7 @@ class ExternalReference BASE_EMBEDDED { explicit ExternalReference(const SCTableReference& table_ref); // Isolate::Current() as an external reference. - static ExternalReference isolate_address(); + static ExternalReference isolate_address(Isolate* isolate); // One-of-a-kind references. These references are not part of a general // pattern. This means that they have to be added to the diff --git a/src/deoptimizer.h b/src/deoptimizer.h index 97b2206b6..edf6c504f 100644 --- a/src/deoptimizer.h +++ b/src/deoptimizer.h @@ -309,6 +309,7 @@ class Deoptimizer : public Malloced { protected: MacroAssembler* masm() const { return masm_; } BailoutType type() const { return type_; } + Isolate* isolate() const { return masm_->isolate(); } virtual void GeneratePrologue() { } diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc index e29d834de..8c6801d7d 100644 --- a/src/ia32/code-stubs-ia32.cc +++ b/src/ia32/code-stubs-ia32.cc @@ -556,7 +556,7 @@ void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { AllowExternalCallThatCantCauseGC scope(masm); __ PrepareCallCFunction(argument_count, ecx); __ mov(Operand(esp, 0 * kPointerSize), - Immediate(ExternalReference::isolate_address())); + Immediate(ExternalReference::isolate_address(masm->isolate()))); __ CallCFunction( ExternalReference::store_buffer_overflow_function(masm->isolate()), argument_count); @@ -3876,7 +3876,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { // Argument 9: Pass current isolate address. __ mov(Operand(esp, 8 * kPointerSize), - Immediate(ExternalReference::isolate_address())); + Immediate(ExternalReference::isolate_address(masm->isolate()))); // Argument 8: Indicate that this is a direct call from JavaScript. __ mov(Operand(esp, 7 * kPointerSize), Immediate(1)); @@ -5030,7 +5030,7 @@ void CEntryStub::GenerateCore(MacroAssembler* masm, __ mov(Operand(esp, 0 * kPointerSize), edi); // argc. __ mov(Operand(esp, 1 * kPointerSize), esi); // argv. __ mov(Operand(esp, 2 * kPointerSize), - Immediate(ExternalReference::isolate_address())); + Immediate(ExternalReference::isolate_address(masm->isolate()))); __ call(ebx); // Result is in eax or edx:eax - do not destroy these registers! @@ -7471,7 +7471,7 @@ void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm, Mode mode) { __ mov(Operand(esp, 0 * kPointerSize), regs_.object()); __ mov(Operand(esp, 1 * kPointerSize), regs_.address()); // Slot. __ mov(Operand(esp, 2 * kPointerSize), - Immediate(ExternalReference::isolate_address())); + Immediate(ExternalReference::isolate_address(masm->isolate()))); AllowExternalCallThatCantCauseGC scope(masm); if (mode == INCREMENTAL_COMPACTION) { diff --git a/src/ia32/deoptimizer-ia32.cc b/src/ia32/deoptimizer-ia32.cc index f0436225c..f8aff48d1 100644 --- a/src/ia32/deoptimizer-ia32.cc +++ b/src/ia32/deoptimizer-ia32.cc @@ -716,8 +716,6 @@ void Deoptimizer::CopyDoubleRegisters(FrameDescription* output_frame) { void Deoptimizer::EntryGenerator::Generate() { GeneratePrologue(); - Isolate* isolate = masm()->isolate(); - // Save all general purpose registers before messing with them. const int kNumberOfRegisters = Register::kNumRegisters; @@ -762,10 +760,10 @@ void Deoptimizer::EntryGenerator::Generate() { __ mov(Operand(esp, 3 * kPointerSize), ecx); // Code address or 0. __ mov(Operand(esp, 4 * kPointerSize), edx); // Fp-to-sp delta. __ mov(Operand(esp, 5 * kPointerSize), - Immediate(ExternalReference::isolate_address())); + Immediate(ExternalReference::isolate_address(isolate()))); { AllowExternalCallThatCantCauseGC scope(masm()); - __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6); + __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6); } // Preserve deoptimizer object in register eax and get the input @@ -828,7 +826,7 @@ void Deoptimizer::EntryGenerator::Generate() { { AllowExternalCallThatCantCauseGC scope(masm()); __ CallCFunction( - ExternalReference::compute_output_frames_function(isolate), 1); + ExternalReference::compute_output_frames_function(isolate()), 1); } __ pop(eax); diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index 0eda69c97..bad052c55 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -2086,7 +2086,8 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address, bind(&delete_allocated_handles); mov(Operand::StaticVariable(limit_address), edi); mov(edi, eax); - mov(Operand(esp, 0), Immediate(ExternalReference::isolate_address())); + mov(Operand(esp, 0), + Immediate(ExternalReference::isolate_address(isolate()))); mov(eax, Immediate(delete_extensions)); call(eax); mov(eax, edi); diff --git a/src/ia32/regexp-macro-assembler-ia32.cc b/src/ia32/regexp-macro-assembler-ia32.cc index d8f2e8f0e..d635fe1a8 100644 --- a/src/ia32/regexp-macro-assembler-ia32.cc +++ b/src/ia32/regexp-macro-assembler-ia32.cc @@ -401,7 +401,7 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase( // Set isolate. __ mov(Operand(esp, 3 * kPointerSize), - Immediate(ExternalReference::isolate_address())); + Immediate(ExternalReference::isolate_address(isolate()))); // Set byte_length. __ mov(Operand(esp, 2 * kPointerSize), ebx); // Set byte_offset2. @@ -417,7 +417,7 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase( { AllowExternalCallThatCantCauseGC scope(masm_); ExternalReference compare = - ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); + ExternalReference::re_case_insensitive_compare_uc16(isolate()); __ CallCFunction(compare, argument_count); } // Pop original values before reacting on result value. @@ -745,7 +745,7 @@ Handle RegExpMacroAssemblerIA32::GetCode(Handle source) { Label stack_ok; ExternalReference stack_limit = - ExternalReference::address_of_stack_limit(masm_->isolate()); + ExternalReference::address_of_stack_limit(isolate()); __ mov(ecx, esp); __ sub(ecx, Operand::StaticVariable(stack_limit)); // Handle it if the stack pointer is already below the stack limit. @@ -972,12 +972,12 @@ Handle RegExpMacroAssemblerIA32::GetCode(Handle source) { static const int num_arguments = 3; __ PrepareCallCFunction(num_arguments, ebx); __ mov(Operand(esp, 2 * kPointerSize), - Immediate(ExternalReference::isolate_address())); + Immediate(ExternalReference::isolate_address(isolate()))); __ lea(eax, Operand(ebp, kStackHighEnd)); __ mov(Operand(esp, 1 * kPointerSize), eax); __ mov(Operand(esp, 0 * kPointerSize), backtrack_stackpointer()); ExternalReference grow_stack = - ExternalReference::re_grow_stack(masm_->isolate()); + ExternalReference::re_grow_stack(isolate()); __ CallCFunction(grow_stack, num_arguments); // If return NULL, we have failed to grow the stack, and // must exit with a stack-overflow exception. @@ -1002,10 +1002,10 @@ Handle RegExpMacroAssemblerIA32::GetCode(Handle source) { CodeDesc code_desc; masm_->GetCode(&code_desc); Handle code = - masm_->isolate()->factory()->NewCode(code_desc, - Code::ComputeFlags(Code::REGEXP), - masm_->CodeObject()); - PROFILE(masm_->isolate(), RegExpCodeCreateEvent(*code, *source)); + isolate()->factory()->NewCode(code_desc, + Code::ComputeFlags(Code::REGEXP), + masm_->CodeObject()); + PROFILE(isolate(), RegExpCodeCreateEvent(*code, *source)); return Handle::cast(code); } @@ -1161,7 +1161,7 @@ void RegExpMacroAssemblerIA32::CallCheckStackGuardState(Register scratch) { __ lea(eax, Operand(esp, -kPointerSize)); __ mov(Operand(esp, 0 * kPointerSize), eax); ExternalReference check_stack_guard = - ExternalReference::re_check_stack_guard_state(masm_->isolate()); + ExternalReference::re_check_stack_guard_state(isolate()); __ CallCFunction(check_stack_guard, num_arguments); } @@ -1353,7 +1353,7 @@ void RegExpMacroAssemblerIA32::CheckPreemption() { // Check for preemption. Label no_preempt; ExternalReference stack_limit = - ExternalReference::address_of_stack_limit(masm_->isolate()); + ExternalReference::address_of_stack_limit(isolate()); __ cmp(esp, Operand::StaticVariable(stack_limit)); __ j(above, &no_preempt); @@ -1366,7 +1366,7 @@ void RegExpMacroAssemblerIA32::CheckPreemption() { void RegExpMacroAssemblerIA32::CheckStackLimit() { Label no_stack_overflow; ExternalReference stack_limit = - ExternalReference::address_of_regexp_stack_limit(masm_->isolate()); + ExternalReference::address_of_regexp_stack_limit(isolate()); __ cmp(backtrack_stackpointer(), Operand::StaticVariable(stack_limit)); __ j(above, &no_stack_overflow); diff --git a/src/ia32/regexp-macro-assembler-ia32.h b/src/ia32/regexp-macro-assembler-ia32.h index 7aea38586..6040d8058 100644 --- a/src/ia32/regexp-macro-assembler-ia32.h +++ b/src/ia32/regexp-macro-assembler-ia32.h @@ -30,6 +30,7 @@ #include "ia32/assembler-ia32.h" #include "ia32/assembler-ia32-inl.h" +#include "macro-assembler.h" namespace v8 { namespace internal { @@ -196,6 +197,8 @@ class RegExpMacroAssemblerIA32: public NativeRegExpMacroAssembler { // (ecx) and increments it by a word size. inline void Pop(Register target); + Isolate* isolate() const { return masm_->isolate(); } + MacroAssembler* masm_; // Which mode to generate code for (ASCII or UC16). diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc index 80c972c37..cc1cf4e9f 100644 --- a/src/mips/code-stubs-mips.cc +++ b/src/mips/code-stubs-mips.cc @@ -1585,7 +1585,7 @@ void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { AllowExternalCallThatCantCauseGC scope(masm); __ PrepareCallCFunction(argument_count, fp_argument_count, scratch); - __ li(a0, Operand(ExternalReference::isolate_address())); + __ li(a0, Operand(ExternalReference::isolate_address(masm->isolate()))); __ CallCFunction( ExternalReference::store_buffer_overflow_function(masm->isolate()), argument_count); @@ -3410,7 +3410,7 @@ void CEntryStub::GenerateCore(MacroAssembler* masm, __ AssertStackIsAligned(); - __ li(a2, Operand(ExternalReference::isolate_address())); + __ li(a2, Operand(ExternalReference::isolate_address(isolate))); // To let the GC traverse the return address of the exit frames, we need to // know where the return address is. The CEntryStub is unmovable, so @@ -4689,7 +4689,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { // Argument 9: Pass current isolate address. // CFunctionArgumentOperand handles MIPS stack argument slots. - __ li(a0, Operand(ExternalReference::isolate_address())); + __ li(a0, Operand(ExternalReference::isolate_address(isolate))); __ sw(a0, MemOperand(sp, 5 * kPointerSize)); // Argument 8: Indicate that this is a direct call from JavaScript. @@ -7303,7 +7303,7 @@ void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm, Mode mode) { __ Move(address, regs_.address()); __ Move(a0, regs_.object()); __ Move(a1, address); - __ li(a2, Operand(ExternalReference::isolate_address())); + __ li(a2, Operand(ExternalReference::isolate_address(masm->isolate()))); AllowExternalCallThatCantCauseGC scope(masm); if (mode == INCREMENTAL_COMPACTION) { diff --git a/src/mips/deoptimizer-mips.cc b/src/mips/deoptimizer-mips.cc index 7896f2013..ecf408732 100644 --- a/src/mips/deoptimizer-mips.cc +++ b/src/mips/deoptimizer-mips.cc @@ -591,8 +591,6 @@ void Deoptimizer::CopyDoubleRegisters(FrameDescription* output_frame) { void Deoptimizer::EntryGenerator::Generate() { GeneratePrologue(); - Isolate* isolate = masm()->isolate(); - // Unlike on ARM we don't save all the registers, just the useful ones. // For the rest, there are gaps on the stack, so the offsets remain the same. const int kNumberOfRegisters = Register::kNumRegisters; @@ -653,12 +651,12 @@ void Deoptimizer::EntryGenerator::Generate() { // a2: bailout id already loaded. // a3: code address or 0 already loaded. __ sw(t0, CFunctionArgumentOperand(5)); // Fp-to-sp delta. - __ li(t1, Operand(ExternalReference::isolate_address())); + __ li(t1, Operand(ExternalReference::isolate_address(isolate()))); __ sw(t1, CFunctionArgumentOperand(6)); // Isolate. // Call Deoptimizer::New(). { AllowExternalCallThatCantCauseGC scope(masm()); - __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6); + __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6); } // Preserve "deoptimizer" object in register v0 and get the input @@ -725,7 +723,7 @@ void Deoptimizer::EntryGenerator::Generate() { { AllowExternalCallThatCantCauseGC scope(masm()); __ CallCFunction( - ExternalReference::compute_output_frames_function(isolate), 1); + ExternalReference::compute_output_frames_function(isolate()), 1); } __ pop(a0); // Restore deoptimizer object (class Deoptimizer). diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index 61d2ebf79..66cb7e4ae 100644 --- a/src/mips/macro-assembler-mips.cc +++ b/src/mips/macro-assembler-mips.cc @@ -4000,7 +4000,7 @@ void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, mov(s0, v0); mov(a0, v0); PrepareCallCFunction(1, s1); - li(a0, Operand(ExternalReference::isolate_address())); + li(a0, Operand(ExternalReference::isolate_address(isolate()))); CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate()), 1); mov(v0, s0); diff --git a/src/mips/regexp-macro-assembler-mips.cc b/src/mips/regexp-macro-assembler-mips.cc index 2fbc0eaa5..7289296d5 100644 --- a/src/mips/regexp-macro-assembler-mips.cc +++ b/src/mips/regexp-macro-assembler-mips.cc @@ -388,7 +388,7 @@ void RegExpMacroAssemblerMIPS::CheckNotBackReferenceIgnoreCase( // Address of current input position. __ Addu(a1, current_input_offset(), Operand(end_of_input_address())); // Isolate. - __ li(a3, Operand(ExternalReference::isolate_address())); + __ li(a3, Operand(ExternalReference::isolate_address(masm_->isolate()))); { AllowExternalCallThatCantCauseGC scope(masm_); @@ -901,7 +901,7 @@ Handle RegExpMacroAssemblerMIPS::GetCode(Handle source) { __ PrepareCallCFunction(num_arguments, a0); __ mov(a0, backtrack_stackpointer()); __ Addu(a1, frame_pointer(), Operand(kStackHighEnd)); - __ li(a2, Operand(ExternalReference::isolate_address())); + __ li(a2, Operand(ExternalReference::isolate_address(masm_->isolate()))); ExternalReference grow_stack = ExternalReference::re_grow_stack(masm_->isolate()); __ CallCFunction(grow_stack, num_arguments); diff --git a/src/mips/regexp-macro-assembler-mips.h b/src/mips/regexp-macro-assembler-mips.h index 8dd52a484..3ad64f9ae 100644 --- a/src/mips/regexp-macro-assembler-mips.h +++ b/src/mips/regexp-macro-assembler-mips.h @@ -229,6 +229,7 @@ class RegExpMacroAssemblerMIPS: public NativeRegExpMacroAssembler { inline void CallCFunctionUsingStub(ExternalReference function, int num_arguments); + Isolate* isolate() const { return masm_->isolate(); } MacroAssembler* masm_; diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc index d6e968d2a..e110c47c6 100644 --- a/src/mips/stub-cache-mips.cc +++ b/src/mips/stub-cache-mips.cc @@ -715,7 +715,7 @@ static void PushInterceptorArguments(MacroAssembler* masm, __ Push(scratch, receiver, holder); __ lw(scratch, FieldMemOperand(scratch, InterceptorInfo::kDataOffset)); __ push(scratch); - __ li(scratch, Operand(ExternalReference::isolate_address())); + __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); __ push(scratch); } @@ -789,7 +789,7 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, __ li(t2, call_data); } - __ li(t3, Operand(ExternalReference::isolate_address())); + __ li(t3, Operand(ExternalReference::isolate_address(masm->isolate()))); // Store JS function, call data and isolate. __ sw(t1, MemOperand(sp, 1 * kPointerSize)); __ sw(t2, MemOperand(sp, 2 * kPointerSize)); @@ -1167,7 +1167,7 @@ Register StubCompiler::CheckPrototypes(Handle object, } // Log the check depth. - LOG(masm()->isolate(), IntEvent("check-maps-depth", depth + 1)); + LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) { // Check the holder map. @@ -1294,13 +1294,13 @@ void BaseLoadStubCompiler::GenerateLoadCallback( __ lw(scratch3(), FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset)); } else { - __ li(scratch3(), Handle(callback->data(), - callback->GetIsolate())); + __ li(scratch3(), Handle(callback->data(), isolate())); } __ Subu(sp, sp, 4 * kPointerSize); __ sw(reg, MemOperand(sp, 3 * kPointerSize)); __ sw(scratch3(), MemOperand(sp, 2 * kPointerSize)); - __ li(scratch3(), Operand(ExternalReference::isolate_address())); + __ li(scratch3(), + Operand(ExternalReference::isolate_address(isolate()))); __ sw(scratch3(), MemOperand(sp, 1 * kPointerSize)); __ sw(name(), MemOperand(sp, 0 * kPointerSize)); @@ -1325,10 +1325,8 @@ void BaseLoadStubCompiler::GenerateLoadCallback( const int kStackUnwindSpace = 5; Address getter_address = v8::ToCData
(callback->getter()); ApiFunction fun(getter_address); - ExternalReference ref = - ExternalReference(&fun, - ExternalReference::DIRECT_GETTER_CALL, - masm()->isolate()); + ExternalReference ref = ExternalReference( + &fun, ExternalReference::DIRECT_GETTER_CALL, isolate()); __ CallApiFunctionAndReturn(ref, kStackUnwindSpace); } @@ -1413,7 +1411,7 @@ void BaseLoadStubCompiler::GenerateLoadInterceptor( this->name(), interceptor_holder); ExternalReference ref = ExternalReference( - IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), masm()->isolate()); + IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate()); __ TailCallExternalReference(ref, 6, 1); } } @@ -1723,11 +1721,9 @@ Handle CallStubCompiler::CompileArrayPushCall( __ bind(&no_fast_elements_check); ExternalReference new_space_allocation_top = - ExternalReference::new_space_allocation_top_address( - masm()->isolate()); + ExternalReference::new_space_allocation_top_address(isolate()); ExternalReference new_space_allocation_limit = - ExternalReference::new_space_allocation_limit_address( - masm()->isolate()); + ExternalReference::new_space_allocation_limit_address(isolate()); const int kAllocationDelta = 4; // Load top and check if it is the end of elements. @@ -1764,10 +1760,8 @@ Handle CallStubCompiler::CompileArrayPushCall( __ Ret(); } __ bind(&call_builtin); - __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush, - masm()->isolate()), - argc + 1, - 1); + __ TailCallExternalReference( + ExternalReference(Builtins::c_ArrayPush, isolate()), argc + 1, 1); } // Handle call cache miss. @@ -1851,10 +1845,8 @@ Handle CallStubCompiler::CompileArrayPopCall( __ Ret(); __ bind(&call_builtin); - __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop, - masm()->isolate()), - argc + 1, - 1); + __ TailCallExternalReference( + ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); // Handle call cache miss. __ bind(&miss); @@ -2418,8 +2410,7 @@ void CallStubCompiler::CompileHandlerFrontend(Handle object, ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK); switch (check) { case RECEIVER_MAP_CHECK: - __ IncrementCounter(masm()->isolate()->counters()->call_const(), - 1, a0, a3); + __ IncrementCounter(isolate()->counters()->call_const(), 1, a0, a3); // Check that the maps haven't changed. CheckPrototypes(Handle::cast(object), a1, holder, a0, a3, t0, @@ -2611,7 +2602,7 @@ Handle CallStubCompiler::CompileCallGlobal( __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); // Jump to the cached code (tail call). - Counters* counters = masm()->isolate()->counters(); + Counters* counters = isolate()->counters(); __ IncrementCounter(counters->call_global_inline(), 1, a3, t0); ParameterCount expected(function->shared()->formal_parameter_count()); CallKind call_kind = CallICBase::Contextual::decode(extra_state_) @@ -2655,8 +2646,7 @@ Handle StoreStubCompiler::CompileStoreCallback( // Do tail-call to the runtime system. ExternalReference store_callback_property = - ExternalReference(IC_Utility(IC::kStoreCallbackProperty), - masm()->isolate()); + ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); __ TailCallExternalReference(store_callback_property, 4, 1); // Handle store cache miss. @@ -2740,8 +2730,7 @@ Handle StoreStubCompiler::CompileStoreInterceptor( // Do tail-call to the runtime system. ExternalReference store_ic_property = - ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), - masm()->isolate()); + ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); __ TailCallExternalReference(store_ic_property, 4, 1); // Handle store cache miss. @@ -2779,7 +2768,7 @@ Handle StoreStubCompiler::CompileStoreGlobal( __ mov(v0, a0); // Stored value must be returned in v0. // Cells are always rescanned, so no write barrier here. - Counters* counters = masm()->isolate()->counters(); + Counters* counters = isolate()->counters(); __ IncrementCounter( counters->named_store_global_inline(), 1, scratch1(), scratch2()); __ Ret(); @@ -2920,7 +2909,7 @@ Handle LoadStubCompiler::CompileLoadGlobal( HandlerFrontendFooter(&success, &miss); __ bind(&success); - Counters* counters = masm()->isolate()->counters(); + Counters* counters = isolate()->counters(); __ IncrementCounter(counters->named_load_global_stub(), 1, a1, a3); __ mov(v0, t0); __ Ret(); @@ -3098,8 +3087,8 @@ Handle ConstructStubCompiler::CompileConstructStub( __ bind(&next); } else { // Set the property to the constant value. - Handle constant(shared->GetThisPropertyAssignmentConstant(i), - masm()->isolate()); + Handle constant( + shared->GetThisPropertyAssignmentConstant(i), isolate()); __ li(a2, Operand(constant)); __ sw(a2, MemOperand(t5)); __ Addu(t5, t5, kPointerSize); @@ -3127,7 +3116,7 @@ Handle ConstructStubCompiler::CompileConstructStub( __ sll(t0, a1, kPointerSizeLog2); __ Addu(sp, sp, t0); __ Addu(sp, sp, Operand(kPointerSize)); - Counters* counters = masm()->isolate()->counters(); + Counters* counters = isolate()->counters(); __ IncrementCounter(counters->constructed_objects(), 1, a1, a2); __ IncrementCounter(counters->constructed_objects_stub(), 1, a1, a2); __ Ret(); @@ -3136,7 +3125,7 @@ Handle ConstructStubCompiler::CompileConstructStub( // construction. __ bind(&generic_stub_call); Handle generic_construct_stub = - masm()->isolate()->builtins()->JSConstructStubGeneric(); + isolate()->builtins()->JSConstructStubGeneric(); __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); // Return the generated code. diff --git a/src/serialize.cc b/src/serialize.cc index 0ba730fd7..d4f31c1e1 100644 --- a/src/serialize.cc +++ b/src/serialize.cc @@ -472,7 +472,7 @@ void ExternalReferenceTable::PopulateTable(Isolate* isolate) { UNCLASSIFIED, 37, "LDoubleConstant::one_half"); - Add(ExternalReference::isolate_address().address(), + Add(ExternalReference::isolate_address(isolate).address(), UNCLASSIFIED, 38, "isolate"); diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc index 2fecc1e44..d40a5bf05 100644 --- a/src/x64/code-stubs-x64.cc +++ b/src/x64/code-stubs-x64.cc @@ -526,9 +526,9 @@ void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { const int argument_count = 1; __ PrepareCallCFunction(argument_count); #ifdef _WIN64 - __ LoadAddress(rcx, ExternalReference::isolate_address()); + __ LoadAddress(rcx, ExternalReference::isolate_address(masm->isolate())); #else - __ LoadAddress(rdi, ExternalReference::isolate_address()); + __ LoadAddress(rdi, ExternalReference::isolate_address(masm->isolate())); #endif AllowExternalCallThatCantCauseGC scope(masm); @@ -2979,9 +2979,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { __ EnterApiExitFrame(argument_slots_on_stack); // Argument 9: Pass current isolate address. - // __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kPointerSize), - // Immediate(ExternalReference::isolate_address())); - __ LoadAddress(kScratchRegister, ExternalReference::isolate_address()); + __ LoadAddress(kScratchRegister, + ExternalReference::isolate_address(masm->isolate())); __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kPointerSize), kScratchRegister); @@ -4117,21 +4116,21 @@ void CEntryStub::GenerateCore(MacroAssembler* masm, // Pass a pointer to the Arguments object as the first argument. // Return result in single register (rax). __ lea(rcx, StackSpaceOperand(0)); - __ LoadAddress(rdx, ExternalReference::isolate_address()); + __ LoadAddress(rdx, ExternalReference::isolate_address(masm->isolate())); } else { ASSERT_EQ(2, result_size_); // Pass a pointer to the result location as the first argument. __ lea(rcx, StackSpaceOperand(2)); // Pass a pointer to the Arguments object as the second argument. __ lea(rdx, StackSpaceOperand(0)); - __ LoadAddress(r8, ExternalReference::isolate_address()); + __ LoadAddress(r8, ExternalReference::isolate_address(masm->isolate())); } #else // _WIN64 // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9. __ movq(rdi, r14); // argc. __ movq(rsi, r15); // argv. - __ movq(rdx, ExternalReference::isolate_address()); + __ movq(rdx, ExternalReference::isolate_address(masm->isolate())); #endif __ call(rbx); // Result is in rax - do not destroy this register! @@ -6499,7 +6498,7 @@ void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm, Mode mode) { __ Move(arg1, regs_.object()); // TODO(gc) Can we just set address arg2 in the beginning? __ Move(arg2, address); - __ LoadAddress(arg3, ExternalReference::isolate_address()); + __ LoadAddress(arg3, ExternalReference::isolate_address(masm->isolate())); int argument_count = 3; AllowExternalCallThatCantCauseGC scope(masm); diff --git a/src/x64/deoptimizer-x64.cc b/src/x64/deoptimizer-x64.cc index bae97cd81..b8ce99ba9 100644 --- a/src/x64/deoptimizer-x64.cc +++ b/src/x64/deoptimizer-x64.cc @@ -657,18 +657,15 @@ void Deoptimizer::EntryGenerator::Generate() { // has created space for this). On linux pass the arguments in r8 and r9. #ifdef _WIN64 __ movq(Operand(rsp, 4 * kPointerSize), arg5); - __ LoadAddress(arg5, ExternalReference::isolate_address()); + __ LoadAddress(arg5, ExternalReference::isolate_address(isolate())); __ movq(Operand(rsp, 5 * kPointerSize), arg5); #else __ movq(r8, arg5); - __ LoadAddress(r9, ExternalReference::isolate_address()); + __ LoadAddress(r9, ExternalReference::isolate_address(isolate())); #endif - Isolate* isolate = masm()->isolate(); - - { - AllowExternalCallThatCantCauseGC scope(masm()); - __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6); + { AllowExternalCallThatCantCauseGC scope(masm()); + __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6); } // Preserve deoptimizer object in register rax and get the input // frame descriptor pointer. @@ -717,11 +714,11 @@ void Deoptimizer::EntryGenerator::Generate() { __ push(rax); __ PrepareCallCFunction(2); __ movq(arg1, rax); - __ LoadAddress(arg2, ExternalReference::isolate_address()); + __ LoadAddress(arg2, ExternalReference::isolate_address(isolate())); { AllowExternalCallThatCantCauseGC scope(masm()); __ CallCFunction( - ExternalReference::compute_output_frames_function(isolate), 2); + ExternalReference::compute_output_frames_function(isolate()), 2); } __ pop(rax); diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index 6e0734d59..c193bb30f 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -818,9 +818,9 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address, movq(Operand(base_reg, kLimitOffset), prev_limit_reg); movq(prev_limit_reg, rax); #ifdef _WIN64 - LoadAddress(rcx, ExternalReference::isolate_address()); + LoadAddress(rcx, ExternalReference::isolate_address(isolate())); #else - LoadAddress(rdi, ExternalReference::isolate_address()); + LoadAddress(rdi, ExternalReference::isolate_address(isolate())); #endif LoadAddress(rax, ExternalReference::delete_handle_scope_extensions(isolate())); diff --git a/src/x64/regexp-macro-assembler-x64.cc b/src/x64/regexp-macro-assembler-x64.cc index 914241ecd..012dcc8b6 100644 --- a/src/x64/regexp-macro-assembler-x64.cc +++ b/src/x64/regexp-macro-assembler-x64.cc @@ -437,7 +437,7 @@ void RegExpMacroAssemblerX64::CheckNotBackReferenceIgnoreCase( // Set byte_length. __ movq(r8, rbx); // Isolate. - __ LoadAddress(r9, ExternalReference::isolate_address()); + __ LoadAddress(r9, ExternalReference::isolate_address(isolate())); #else // AMD64 calling convention // Compute byte_offset2 (current position = rsi+rdi). __ lea(rax, Operand(rsi, rdi, times_1, 0)); @@ -448,14 +448,14 @@ void RegExpMacroAssemblerX64::CheckNotBackReferenceIgnoreCase( // Set byte_length. __ movq(rdx, rbx); // Isolate. - __ LoadAddress(rcx, ExternalReference::isolate_address()); + __ LoadAddress(rcx, ExternalReference::isolate_address(isolate())); #endif { // NOLINT: Can't find a way to open this scope without confusing the // linter. AllowExternalCallThatCantCauseGC scope(&masm_); ExternalReference compare = - ExternalReference::re_case_insensitive_compare_uc16(masm_.isolate()); + ExternalReference::re_case_insensitive_compare_uc16(isolate()); __ CallCFunction(compare, num_arguments); } @@ -810,7 +810,7 @@ Handle RegExpMacroAssemblerX64::GetCode(Handle source) { Label stack_ok; ExternalReference stack_limit = - ExternalReference::address_of_stack_limit(masm_.isolate()); + ExternalReference::address_of_stack_limit(isolate()); __ movq(rcx, rsp); __ movq(kScratchRegister, stack_limit); __ subq(rcx, Operand(kScratchRegister, 0)); @@ -1055,15 +1055,15 @@ Handle RegExpMacroAssemblerX64::GetCode(Handle source) { // Microsoft passes parameters in rcx, rdx, r8. // First argument, backtrack stackpointer, is already in rcx. __ lea(rdx, Operand(rbp, kStackHighEnd)); // Second argument - __ LoadAddress(r8, ExternalReference::isolate_address()); + __ LoadAddress(r8, ExternalReference::isolate_address(isolate())); #else // AMD64 ABI passes parameters in rdi, rsi, rdx. __ movq(rdi, backtrack_stackpointer()); // First argument. __ lea(rsi, Operand(rbp, kStackHighEnd)); // Second argument. - __ LoadAddress(rdx, ExternalReference::isolate_address()); + __ LoadAddress(rdx, ExternalReference::isolate_address(isolate())); #endif ExternalReference grow_stack = - ExternalReference::re_grow_stack(masm_.isolate()); + ExternalReference::re_grow_stack(isolate()); __ CallCFunction(grow_stack, num_arguments); // If return NULL, we have failed to grow the stack, and // must exit with a stack-overflow exception. @@ -1266,7 +1266,7 @@ void RegExpMacroAssemblerX64::CallCheckStackGuardState() { __ lea(rdi, Operand(rsp, -kPointerSize)); #endif ExternalReference stack_check = - ExternalReference::re_check_stack_guard_state(masm_.isolate()); + ExternalReference::re_check_stack_guard_state(isolate()); __ CallCFunction(stack_check, num_arguments); } @@ -1485,7 +1485,7 @@ void RegExpMacroAssemblerX64::CheckPreemption() { // Check for preemption. Label no_preempt; ExternalReference stack_limit = - ExternalReference::address_of_stack_limit(masm_.isolate()); + ExternalReference::address_of_stack_limit(isolate()); __ load_rax(stack_limit); __ cmpq(rsp, rax); __ j(above, &no_preempt); @@ -1499,7 +1499,7 @@ void RegExpMacroAssemblerX64::CheckPreemption() { void RegExpMacroAssemblerX64::CheckStackLimit() { Label no_stack_overflow; ExternalReference stack_limit = - ExternalReference::address_of_regexp_stack_limit(masm_.isolate()); + ExternalReference::address_of_regexp_stack_limit(isolate()); __ load_rax(stack_limit); __ cmpq(backtrack_stackpointer(), rax); __ j(above, &no_stack_overflow); diff --git a/src/x64/regexp-macro-assembler-x64.h b/src/x64/regexp-macro-assembler-x64.h index a082cf2df..296c86601 100644 --- a/src/x64/regexp-macro-assembler-x64.h +++ b/src/x64/regexp-macro-assembler-x64.h @@ -272,6 +272,8 @@ class RegExpMacroAssemblerX64: public NativeRegExpMacroAssembler { // Increments the stack pointer (rcx) by a word size. inline void Drop(); + Isolate* isolate() const { return masm_.isolate(); } + MacroAssembler masm_; MacroAssembler::NoRootArrayScope no_root_array_scope_; diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc index 0384d2521..40f559097 100644 --- a/src/x64/stub-cache-x64.cc +++ b/src/x64/stub-cache-x64.cc @@ -372,7 +372,7 @@ static void PushInterceptorArguments(MacroAssembler* masm, __ push(receiver); __ push(holder); __ push(FieldOperand(kScratchRegister, InterceptorInfo::kDataOffset)); - __ PushAddress(ExternalReference::isolate_address()); + __ PushAddress(ExternalReference::isolate_address(masm->isolate())); } @@ -468,7 +468,8 @@ static void GenerateFastApiCall(MacroAssembler* masm, } else { __ Move(Operand(rsp, 3 * kPointerSize), call_data); } - __ movq(kScratchRegister, ExternalReference::isolate_address()); + __ movq(kScratchRegister, + ExternalReference::isolate_address(masm->isolate())); __ movq(Operand(rsp, 4 * kPointerSize), kScratchRegister); // Prepare arguments. @@ -1178,7 +1179,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback( } else { __ Push(Handle(callback->data(), isolate())); } - __ PushAddress(ExternalReference::isolate_address()); // isolate + __ PushAddress(ExternalReference::isolate_address(isolate())); // isolate __ push(name()); // name // Save a pointer to where we pushed the arguments pointer. This will be // passed as the const ExecutableAccessorInfo& to the C++ callback. -- 2.34.1