Index: src/assembler.cc |
diff --git a/src/assembler.cc b/src/assembler.cc |
index a0e3dc6678ad2f15ead688a866c19026bc52982d..c6d1cfa0c879afe1388ffa5195e22e2e38809f6c 100644 |
--- a/src/assembler.cc |
+++ b/src/assembler.cc |
@@ -552,25 +552,29 @@ void RelocInfo::Verify() { |
// ----------------------------------------------------------------------------- |
// Implementation of ExternalReference |
-ExternalReference::ExternalReference(Builtins::CFunctionId id) |
- : address_(Redirect(Builtins::c_function_address(id))) {} |
+ExternalReference::ExternalReference(Builtins::CFunctionId id, Isolate* isolate) |
+ : address_(Redirect(isolate, Builtins::c_function_address(id))) {} |
ExternalReference::ExternalReference( |
- ApiFunction* fun, Type type = ExternalReference::BUILTIN_CALL) |
- : address_(Redirect(fun->address(), type)) {} |
+ ApiFunction* fun, |
+ Type type = ExternalReference::BUILTIN_CALL, |
+ Isolate* isolate = NULL) |
+ : address_(Redirect(isolate, fun->address(), type)) {} |
-ExternalReference::ExternalReference(Builtins::Name name) |
- : address_(Isolate::Current()->builtins()->builtin_address(name)) {} |
+ExternalReference::ExternalReference(Builtins::Name name, Isolate* isolate) |
+ : address_(isolate->builtins()->builtin_address(name)) {} |
-ExternalReference::ExternalReference(Runtime::FunctionId id) |
- : address_(Redirect(Runtime::FunctionForId(id)->entry)) {} |
+ExternalReference::ExternalReference(Runtime::FunctionId id, |
+ Isolate* isolate) |
+ : address_(Redirect(isolate, Runtime::FunctionForId(id)->entry)) {} |
-ExternalReference::ExternalReference(const Runtime::Function* f) |
- : address_(Redirect(f->entry)) {} |
+ExternalReference::ExternalReference(const Runtime::Function* f, |
+ Isolate* isolate) |
+ : address_(Redirect(isolate, f->entry)) {} |
ExternalReference ExternalReference::isolate_address() { |
@@ -578,139 +582,154 @@ ExternalReference ExternalReference::isolate_address() { |
} |
-ExternalReference::ExternalReference(const IC_Utility& ic_utility) |
- : address_(Redirect(ic_utility.address())) {} |
+ExternalReference::ExternalReference(const IC_Utility& ic_utility, |
+ Isolate* isolate) |
+ : address_(Redirect(isolate, ic_utility.address())) {} |
#ifdef ENABLE_DEBUGGER_SUPPORT |
-ExternalReference::ExternalReference(const Debug_Address& debug_address) |
- : address_(debug_address.address(Isolate::Current())) {} |
+ExternalReference::ExternalReference(const Debug_Address& debug_address, |
+ Isolate* isolate) |
+ : address_(debug_address.address(isolate)) {} |
#endif |
ExternalReference::ExternalReference(StatsCounter* counter) |
: address_(reinterpret_cast<Address>(counter->GetInternalPointer())) {} |
-ExternalReference::ExternalReference(Isolate::AddressId id) |
- : address_(Isolate::Current()->get_address_from_id(id)) {} |
+ExternalReference::ExternalReference(Isolate::AddressId id, Isolate* isolate) |
+ : address_(isolate->get_address_from_id(id)) {} |
ExternalReference::ExternalReference(const SCTableReference& table_ref) |
: address_(table_ref.address()) {} |
-ExternalReference ExternalReference::perform_gc_function() { |
- return ExternalReference(Redirect(FUNCTION_ADDR(Runtime::PerformGC))); |
+ExternalReference ExternalReference::perform_gc_function(Isolate* isolate) { |
+ return ExternalReference(Redirect(isolate, |
+ FUNCTION_ADDR(Runtime::PerformGC))); |
} |
-ExternalReference ExternalReference::fill_heap_number_with_random_function() { |
- return |
- ExternalReference(Redirect(FUNCTION_ADDR(V8::FillHeapNumberWithRandom))); |
+ExternalReference ExternalReference::fill_heap_number_with_random_function( |
+ Isolate* isolate) { |
+ return ExternalReference(Redirect( |
+ isolate, |
+ FUNCTION_ADDR(V8::FillHeapNumberWithRandom))); |
} |
-ExternalReference ExternalReference::delete_handle_scope_extensions() { |
- return ExternalReference(Redirect(FUNCTION_ADDR( |
- HandleScope::DeleteExtensions))); |
+ExternalReference ExternalReference::delete_handle_scope_extensions( |
+ Isolate* isolate) { |
+ return ExternalReference(Redirect( |
+ isolate, |
+ FUNCTION_ADDR(HandleScope::DeleteExtensions))); |
} |
-ExternalReference ExternalReference::random_uint32_function() { |
- return ExternalReference(Redirect(FUNCTION_ADDR(V8::Random))); |
+ExternalReference ExternalReference::random_uint32_function( |
+ Isolate* isolate) { |
+ return ExternalReference(Redirect(isolate, FUNCTION_ADDR(V8::Random))); |
} |
-ExternalReference ExternalReference::transcendental_cache_array_address() { |
- return ExternalReference(Isolate::Current()->transcendental_cache()-> |
- cache_array_address()); |
+ExternalReference ExternalReference::transcendental_cache_array_address( |
+ Isolate* isolate) { |
+ return ExternalReference( |
+ isolate->transcendental_cache()->cache_array_address()); |
} |
-ExternalReference ExternalReference::new_deoptimizer_function() { |
+ExternalReference ExternalReference::new_deoptimizer_function( |
+ Isolate* isolate) { |
return ExternalReference( |
- Redirect(FUNCTION_ADDR(Deoptimizer::New))); |
+ Redirect(isolate, FUNCTION_ADDR(Deoptimizer::New))); |
} |
-ExternalReference ExternalReference::compute_output_frames_function() { |
+ExternalReference ExternalReference::compute_output_frames_function( |
+ Isolate* isolate) { |
return ExternalReference( |
- Redirect(FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames))); |
+ Redirect(isolate, FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames))); |
} |
-ExternalReference ExternalReference::global_contexts_list() { |
- return ExternalReference(Isolate::Current()-> |
- heap()->global_contexts_list_address()); |
+ExternalReference ExternalReference::global_contexts_list(Isolate* isolate) { |
+ return ExternalReference(isolate->heap()->global_contexts_list_address()); |
} |
-ExternalReference ExternalReference::keyed_lookup_cache_keys() { |
- return ExternalReference(Isolate::Current()-> |
- keyed_lookup_cache()->keys_address()); |
+ExternalReference ExternalReference::keyed_lookup_cache_keys(Isolate* isolate) { |
+ return ExternalReference(isolate->keyed_lookup_cache()->keys_address()); |
} |
-ExternalReference ExternalReference::keyed_lookup_cache_field_offsets() { |
- return ExternalReference(Isolate::Current()-> |
- keyed_lookup_cache()->field_offsets_address()); |
+ExternalReference ExternalReference::keyed_lookup_cache_field_offsets( |
+ Isolate* isolate) { |
+ return ExternalReference( |
+ isolate->keyed_lookup_cache()->field_offsets_address()); |
} |
-ExternalReference ExternalReference::the_hole_value_location() { |
- return ExternalReference(FACTORY->the_hole_value().location()); |
+ExternalReference ExternalReference::the_hole_value_location(Isolate* isolate) { |
+ return ExternalReference(isolate->factory()->the_hole_value().location()); |
} |
-ExternalReference ExternalReference::arguments_marker_location() { |
- return ExternalReference(FACTORY->arguments_marker().location()); |
+ExternalReference ExternalReference::arguments_marker_location( |
+ Isolate* isolate) { |
+ return ExternalReference(isolate->factory()->arguments_marker().location()); |
} |
-ExternalReference ExternalReference::roots_address() { |
- return ExternalReference(HEAP->roots_address()); |
+ExternalReference ExternalReference::roots_address(Isolate* isolate) { |
+ return ExternalReference(isolate->heap()->roots_address()); |
} |
-ExternalReference ExternalReference::address_of_stack_limit() { |
- return ExternalReference( |
- Isolate::Current()->stack_guard()->address_of_jslimit()); |
+ExternalReference ExternalReference::address_of_stack_limit(Isolate* isolate) { |
+ return ExternalReference(isolate->stack_guard()->address_of_jslimit()); |
} |
-ExternalReference ExternalReference::address_of_real_stack_limit() { |
- return ExternalReference( |
- Isolate::Current()->stack_guard()->address_of_real_jslimit()); |
+ExternalReference ExternalReference::address_of_real_stack_limit( |
+ Isolate* isolate) { |
+ return ExternalReference(isolate->stack_guard()->address_of_real_jslimit()); |
} |
-ExternalReference ExternalReference::address_of_regexp_stack_limit() { |
- return ExternalReference( |
- Isolate::Current()->regexp_stack()->limit_address()); |
+ExternalReference ExternalReference::address_of_regexp_stack_limit( |
+ Isolate* isolate) { |
+ return ExternalReference(isolate->regexp_stack()->limit_address()); |
} |
-ExternalReference ExternalReference::new_space_start() { |
- return ExternalReference(HEAP->NewSpaceStart()); |
+ExternalReference ExternalReference::new_space_start(Isolate* isolate) { |
+ return ExternalReference(isolate->heap()->NewSpaceStart()); |
} |
-ExternalReference ExternalReference::new_space_mask() { |
- return ExternalReference(reinterpret_cast<Address>(HEAP->NewSpaceMask())); |
+ExternalReference ExternalReference::new_space_mask(Isolate* isolate) { |
+ Address mask = reinterpret_cast<Address>(isolate->heap()->NewSpaceMask()); |
+ return ExternalReference(mask); |
} |
-ExternalReference ExternalReference::new_space_allocation_top_address() { |
- return ExternalReference(HEAP->NewSpaceAllocationTopAddress()); |
+ExternalReference ExternalReference::new_space_allocation_top_address( |
+ Isolate* isolate) { |
+ return ExternalReference(isolate->heap()->NewSpaceAllocationTopAddress()); |
} |
-ExternalReference ExternalReference::heap_always_allocate_scope_depth() { |
- return ExternalReference(HEAP->always_allocate_scope_depth_address()); |
+ExternalReference ExternalReference::heap_always_allocate_scope_depth( |
+ Isolate* isolate) { |
+ Heap* heap = isolate->heap(); |
+ return ExternalReference(heap->always_allocate_scope_depth_address()); |
} |
-ExternalReference ExternalReference::new_space_allocation_limit_address() { |
- return ExternalReference(HEAP->NewSpaceAllocationLimitAddress()); |
+ExternalReference ExternalReference::new_space_allocation_limit_address( |
+ Isolate* isolate) { |
+ return ExternalReference(isolate->heap()->NewSpaceAllocationLimitAddress()); |
} |
@@ -729,8 +748,9 @@ ExternalReference ExternalReference::handle_scope_limit_address() { |
} |
-ExternalReference ExternalReference::scheduled_exception_address() { |
- return ExternalReference(Isolate::Current()->scheduled_exception_address()); |
+ExternalReference ExternalReference::scheduled_exception_address( |
+ Isolate* isolate) { |
+ return ExternalReference(isolate->scheduled_exception_address()); |
} |
@@ -766,7 +786,8 @@ ExternalReference ExternalReference::address_of_nan() { |
#ifndef V8_INTERPRETED_REGEXP |
-ExternalReference ExternalReference::re_check_stack_guard_state() { |
+ExternalReference ExternalReference::re_check_stack_guard_state( |
+ Isolate* isolate) { |
Address function; |
#ifdef V8_TARGET_ARCH_X64 |
function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState); |
@@ -777,16 +798,18 @@ ExternalReference ExternalReference::re_check_stack_guard_state() { |
#else |
UNREACHABLE(); |
#endif |
- return ExternalReference(Redirect(function)); |
+ return ExternalReference(Redirect(isolate, function)); |
} |
-ExternalReference ExternalReference::re_grow_stack() { |
+ExternalReference ExternalReference::re_grow_stack(Isolate* isolate) { |
return ExternalReference( |
- Redirect(FUNCTION_ADDR(NativeRegExpMacroAssembler::GrowStack))); |
+ Redirect(isolate, FUNCTION_ADDR(NativeRegExpMacroAssembler::GrowStack))); |
} |
-ExternalReference ExternalReference::re_case_insensitive_compare_uc16() { |
+ExternalReference ExternalReference::re_case_insensitive_compare_uc16( |
+ Isolate* isolate) { |
return ExternalReference(Redirect( |
+ isolate, |
FUNCTION_ADDR(NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16))); |
} |
@@ -795,19 +818,21 @@ ExternalReference ExternalReference::re_word_character_map() { |
NativeRegExpMacroAssembler::word_character_map_address()); |
} |
-ExternalReference ExternalReference::address_of_static_offsets_vector() { |
- return ExternalReference(OffsetsVector::static_offsets_vector_address( |
- Isolate::Current())); |
+ExternalReference ExternalReference::address_of_static_offsets_vector( |
+ Isolate* isolate) { |
+ return ExternalReference( |
+ OffsetsVector::static_offsets_vector_address(isolate)); |
} |
-ExternalReference ExternalReference::address_of_regexp_stack_memory_address() { |
+ExternalReference ExternalReference::address_of_regexp_stack_memory_address( |
+ Isolate* isolate) { |
return ExternalReference( |
- Isolate::Current()->regexp_stack()->memory_address()); |
+ isolate->regexp_stack()->memory_address()); |
} |
-ExternalReference ExternalReference::address_of_regexp_stack_memory_size() { |
- return ExternalReference( |
- Isolate::Current()->regexp_stack()->memory_size_address()); |
+ExternalReference ExternalReference::address_of_regexp_stack_memory_size( |
+ Isolate* isolate) { |
+ return ExternalReference(isolate->regexp_stack()->memory_size_address()); |
} |
#endif // V8_INTERPRETED_REGEXP |
@@ -853,20 +878,26 @@ static double math_log_double(double x) { |
} |
-ExternalReference ExternalReference::math_sin_double_function() { |
- return ExternalReference(Redirect(FUNCTION_ADDR(math_sin_double), |
+ExternalReference ExternalReference::math_sin_double_function( |
+ Isolate* isolate) { |
+ return ExternalReference(Redirect(isolate, |
+ FUNCTION_ADDR(math_sin_double), |
FP_RETURN_CALL)); |
} |
-ExternalReference ExternalReference::math_cos_double_function() { |
- return ExternalReference(Redirect(FUNCTION_ADDR(math_cos_double), |
+ExternalReference ExternalReference::math_cos_double_function( |
+ Isolate* isolate) { |
+ return ExternalReference(Redirect(isolate, |
+ FUNCTION_ADDR(math_cos_double), |
FP_RETURN_CALL)); |
} |
-ExternalReference ExternalReference::math_log_double_function() { |
- return ExternalReference(Redirect(FUNCTION_ADDR(math_log_double), |
+ExternalReference ExternalReference::math_log_double_function( |
+ Isolate* isolate) { |
+ return ExternalReference(Redirect(isolate, |
+ FUNCTION_ADDR(math_log_double), |
FP_RETURN_CALL)); |
} |
@@ -906,14 +937,18 @@ double power_double_double(double x, double y) { |
} |
-ExternalReference ExternalReference::power_double_double_function() { |
- return ExternalReference(Redirect(FUNCTION_ADDR(power_double_double), |
+ExternalReference ExternalReference::power_double_double_function( |
+ Isolate* isolate) { |
+ return ExternalReference(Redirect(isolate, |
+ FUNCTION_ADDR(power_double_double), |
FP_RETURN_CALL)); |
} |
-ExternalReference ExternalReference::power_double_int_function() { |
- return ExternalReference(Redirect(FUNCTION_ADDR(power_double_int), |
+ExternalReference ExternalReference::power_double_int_function( |
+ Isolate* isolate) { |
+ return ExternalReference(Redirect(isolate, |
+ FUNCTION_ADDR(power_double_int), |
FP_RETURN_CALL)); |
} |
@@ -925,7 +960,7 @@ static int native_compare_doubles(double y, double x) { |
ExternalReference ExternalReference::double_fp_operation( |
- Token::Value operation) { |
+ Token::Value operation, Isolate* isolate) { |
typedef double BinaryFPOperation(double x, double y); |
BinaryFPOperation* function = NULL; |
switch (operation) { |
@@ -948,24 +983,28 @@ ExternalReference ExternalReference::double_fp_operation( |
UNREACHABLE(); |
} |
// Passing true as 2nd parameter indicates that they return an fp value. |
- return ExternalReference(Redirect(FUNCTION_ADDR(function), FP_RETURN_CALL)); |
+ return ExternalReference(Redirect(isolate, |
+ FUNCTION_ADDR(function), |
+ FP_RETURN_CALL)); |
} |
-ExternalReference ExternalReference::compare_doubles() { |
- return ExternalReference(Redirect(FUNCTION_ADDR(native_compare_doubles), |
+ExternalReference ExternalReference::compare_doubles(Isolate* isolate) { |
+ return ExternalReference(Redirect(isolate, |
+ FUNCTION_ADDR(native_compare_doubles), |
BUILTIN_CALL)); |
} |
#ifdef ENABLE_DEBUGGER_SUPPORT |
-ExternalReference ExternalReference::debug_break() { |
- return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); |
+ExternalReference ExternalReference::debug_break(Isolate* isolate) { |
+ return ExternalReference(Redirect(isolate, FUNCTION_ADDR(Debug::Break))); |
} |
-ExternalReference ExternalReference::debug_step_in_fp_address() { |
- return ExternalReference(Isolate::Current()->debug()->step_in_fp_addr()); |
+ExternalReference ExternalReference::debug_step_in_fp_address( |
+ Isolate* isolate) { |
+ return ExternalReference(isolate->debug()->step_in_fp_addr()); |
} |
#endif |