From d5f589808d508d3eee76e01e529d32b1486f93c9 Mon Sep 17 00:00:00 2001 From: "svenpanne@chromium.org" Date: Fri, 16 Nov 2012 08:38:11 +0000 Subject: [PATCH] Removed a bunch of GetExistingThreadLocal calls by threading the Isolate. For Octane, the number of calls go down from 7341629 to 1947880, i.e. they are reduced by more than 73%. TLS access is not especially cheap, so this exercise seems worthwhile. Review URL: https://codereview.chromium.org/11412007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12979 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/api.cc | 9 +++-- src/arm/full-codegen-arm.cc | 4 +- src/factory.cc | 4 +- src/handles.h | 4 +- src/hydrogen.cc | 8 ++-- src/ia32/full-codegen-ia32.cc | 4 +- src/ic-inl.h | 3 +- src/ic.cc | 5 ++- src/mips/full-codegen-mips.cc | 4 +- src/objects.cc | 58 +++++++++++++++------------- src/objects.h | 4 +- src/parser.cc | 3 +- src/runtime.cc | 2 +- src/stub-cache.cc | 73 +++++++++++++++++++++++------------ src/type-info.cc | 2 +- src/variables.h | 4 +- src/x64/full-codegen-x64.cc | 4 +- 17 files changed, 112 insertions(+), 83 deletions(-) diff --git a/src/api.cc b/src/api.cc index a6619f1372..3c4496055f 100644 --- a/src/api.cc +++ b/src/api.cc @@ -905,7 +905,7 @@ i::Object** v8::HandleScope::RawClose(i::Object** value) { } // Allocate a new handle on the previous handle block. - i::Handle handle(result); + i::Handle handle(result, isolate_); return handle.location(); } @@ -3414,7 +3414,7 @@ v8::Local v8::Object::GetHiddenValue(v8::Handle key) { i::Handle self = Utils::OpenHandle(this); i::Handle key_obj = Utils::OpenHandle(*key); i::Handle key_symbol = FACTORY->LookupSymbol(key_obj); - i::Handle result(self->GetHiddenProperty(*key_symbol)); + i::Handle result(self->GetHiddenProperty(*key_symbol), isolate); if (result->IsUndefined()) return v8::Local(); return Utils::ToLocal(result); } @@ -4649,13 +4649,14 @@ v8::Local Context::GetCalling() { v8::Local Context::Global() { - if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) { + i::Isolate* isolate = i::Isolate::Current(); + if (IsDeadCheck(isolate, "v8::Context::Global()")) { return Local(); } i::Object** ctx = reinterpret_cast(this); i::Handle context = i::Handle::cast(i::Handle(ctx)); - i::Handle global(context->global_proxy()); + i::Handle global(context->global_proxy(), isolate); return Utils::ToLocal(i::Handle::cast(global)); } diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc index b6267c91e7..83b438b1c7 100644 --- a/src/arm/full-codegen-arm.cc +++ b/src/arm/full-codegen-arm.cc @@ -130,7 +130,7 @@ void FullCodeGenerator::Generate() { handler_table_ = isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); profiling_counter_ = isolate()->factory()->NewJSGlobalPropertyCell( - Handle(Smi::FromInt(FLAG_interrupt_budget))); + Handle(Smi::FromInt(FLAG_interrupt_budget), isolate())); SetFunctionPosition(function()); Comment cmnt(masm_, "[ function compiled by full code generator"); @@ -2377,7 +2377,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { VariableProxy* proxy = callee->AsVariableProxy(); Property* property = callee->AsProperty(); - if (proxy != NULL && proxy->var()->is_possibly_eval()) { + if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { // In a call to eval, we first call %ResolvePossiblyDirectEval to // resolve the function we need to call and the receiver of the // call. Then we call the resolved function using the given diff --git a/src/factory.cc b/src/factory.cc index 279bd8f7ba..b5f6c56a96 100644 --- a/src/factory.cc +++ b/src/factory.cc @@ -1367,7 +1367,7 @@ Handle Factory::ObjectLiteralMapFromCache(Handle context, // Check to see whether there is a matching element in the cache. Handle cache = Handle(MapCache::cast(context->map_cache())); - Handle result = Handle(cache->Lookup(*keys)); + Handle result = Handle(cache->Lookup(*keys), isolate()); if (result->IsMap()) return Handle::cast(result); // Create a new map and add it to the cache. Handle map = @@ -1419,7 +1419,7 @@ void Factory::ConfigureInstance(Handle desc, bool* pending_exception) { // Configure the instance by adding the properties specified by the // instance template. - Handle instance_template = Handle(desc->instance_template()); + Handle instance_template(desc->instance_template(), isolate()); if (!instance_template->IsUndefined()) { Execution::ConfigureInstance(instance, instance_template, diff --git a/src/handles.h b/src/handles.h index b80dbe523d..3b0d2f7ccf 100644 --- a/src/handles.h +++ b/src/handles.h @@ -97,8 +97,8 @@ class Handle { // Convenience wrapper. template -inline Handle handle(T* t) { - return Handle(t); +inline Handle handle(T* t, Isolate* isolate) { + return Handle(t, isolate); } diff --git a/src/hydrogen.cc b/src/hydrogen.cc index ea3a070a16..da69d79260 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -3237,9 +3237,8 @@ HGraph* HGraphBuilder::CreateGraph() { // optimization. Disable optimistic LICM in that case. Handle unoptimized_code(info()->shared_info()->code()); ASSERT(unoptimized_code->kind() == Code::FUNCTION); - Handle maybe_type_info(unoptimized_code->type_feedback_info()); Handle type_info( - Handle::cast(maybe_type_info)); + TypeFeedbackInfo::cast(unoptimized_code->type_feedback_info())); int checksum = type_info->own_type_change_checksum(); int composite_checksum = graph()->update_type_change_checksum(checksum); graph()->set_use_optimistic_licm( @@ -7115,9 +7114,8 @@ bool HGraphBuilder::TryInline(CallKind call_kind, inlined_count_ += nodes_added; ASSERT(unoptimized_code->kind() == Code::FUNCTION); - Handle maybe_type_info(unoptimized_code->type_feedback_info()); Handle type_info( - Handle::cast(maybe_type_info)); + TypeFeedbackInfo::cast(unoptimized_code->type_feedback_info())); graph()->update_type_change_checksum(type_info->own_type_change_checksum()); TraceInline(target, caller, NULL); @@ -7642,7 +7640,7 @@ void HGraphBuilder::VisitCall(Call* expr) { VariableProxy* proxy = expr->expression()->AsVariableProxy(); bool global_call = proxy != NULL && proxy->var()->IsUnallocated(); - if (proxy != NULL && proxy->var()->is_possibly_eval()) { + if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { return Bailout("possible direct call to eval"); } diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc index d423d68108..c7c6f8a509 100644 --- a/src/ia32/full-codegen-ia32.cc +++ b/src/ia32/full-codegen-ia32.cc @@ -119,7 +119,7 @@ void FullCodeGenerator::Generate() { handler_table_ = isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); profiling_counter_ = isolate()->factory()->NewJSGlobalPropertyCell( - Handle(Smi::FromInt(FLAG_interrupt_budget))); + Handle(Smi::FromInt(FLAG_interrupt_budget), isolate())); SetFunctionPosition(function()); Comment cmnt(masm_, "[ function compiled by full code generator"); @@ -2329,7 +2329,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { VariableProxy* proxy = callee->AsVariableProxy(); Property* property = callee->AsProperty(); - if (proxy != NULL && proxy->var()->is_possibly_eval()) { + if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { // In a call to eval, we first call %ResolvePossiblyDirectEval to // resolve the function we need to call and the receiver of the call. // Then we call the resolved function using the given arguments. diff --git a/src/ic-inl.h b/src/ic-inl.h index 49b6ef9d0f..77f409a1ef 100644 --- a/src/ic-inl.h +++ b/src/ic-inl.h @@ -43,7 +43,8 @@ Address IC::address() const { Address result = Assembler::target_address_from_return_address(pc()); #ifdef ENABLE_DEBUGGER_SUPPORT - Debug* debug = Isolate::Current()->debug(); + ASSERT(Isolate::Current() == isolate()); + Debug* debug = isolate()->debug(); // First check if any break points are active if not just return the address // of the call. if (!debug->has_break_points()) return result; diff --git a/src/ic.cc b/src/ic.cc index d46a24b7b9..5212004fa5 100644 --- a/src/ic.cc +++ b/src/ic.cc @@ -310,7 +310,8 @@ void IC::PostPatching(Address address, Code* target, Code* old_target) { if (FLAG_type_info_threshold == 0 && !FLAG_watch_ic_patching) { return; } - Code* host = target->GetHeap()->isolate()-> + Isolate* isolate = target->GetHeap()->isolate(); + Code* host = isolate-> inner_pointer_to_code_cache()->GetCacheEntry(address)->code; if (host->kind() != Code::FUNCTION) return; @@ -333,7 +334,7 @@ void IC::PostPatching(Address address, Code* target, Code* old_target) { } if (FLAG_watch_ic_patching) { host->set_profiler_ticks(0); - Isolate::Current()->runtime_profiler()->NotifyICChanged(); + isolate->runtime_profiler()->NotifyICChanged(); } // TODO(2029): When an optimized function is patched, it would // be nice to propagate the corresponding type information to its diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index dcb9ed90a4..d408c8b0d5 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -139,7 +139,7 @@ void FullCodeGenerator::Generate() { handler_table_ = isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); profiling_counter_ = isolate()->factory()->NewJSGlobalPropertyCell( - Handle(Smi::FromInt(FLAG_interrupt_budget))); + Handle(Smi::FromInt(FLAG_interrupt_budget), isolate())); SetFunctionPosition(function()); Comment cmnt(masm_, "[ function compiled by full code generator"); @@ -2405,7 +2405,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { VariableProxy* proxy = callee->AsVariableProxy(); Property* property = callee->AsProperty(); - if (proxy != NULL && proxy->var()->is_possibly_eval()) { + if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { // In a call to eval, we first call %ResolvePossiblyDirectEval to // resolve the function we need to call and the receiver of the // call. Then we call the resolved function using the given diff --git a/src/objects.cc b/src/objects.cc index abf64dc7a4..666320a50a 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -1678,6 +1678,7 @@ MaybeObject* JSObject::AddProperty(String* name, ASSERT(!IsJSGlobalProxy()); Map* map_of_this = map(); Heap* heap = GetHeap(); + Isolate* isolate = heap->isolate(); MaybeObject* result; if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK && !map_of_this->is_extensible()) { @@ -1685,7 +1686,7 @@ MaybeObject* JSObject::AddProperty(String* name, return value; } else { Handle args[1] = {Handle(name)}; - return heap->isolate()->Throw( + return isolate->Throw( *FACTORY->NewTypeError("object_not_extensible", HandleVector(args, 1))); } @@ -1715,11 +1716,13 @@ MaybeObject* JSObject::AddProperty(String* name, } Handle hresult; - if (!result->ToHandle(&hresult)) return result; + if (!result->ToHandle(&hresult, isolate)) return result; if (FLAG_harmony_observation && map()->is_observed()) { - EnqueueChangeRecord(handle(this), "new", handle(name), - handle(heap->the_hole_value())); + EnqueueChangeRecord(handle(this, isolate), + "new", + handle(name, isolate), + handle(heap->the_hole_value(), isolate)); } return *hresult; @@ -2855,6 +2858,7 @@ MaybeObject* JSObject::SetPropertyForResult(LookupResult* lookup, StrictModeFlag strict_mode, StoreFromKeyed store_mode) { Heap* heap = GetHeap(); + Isolate* isolate = heap->isolate(); // Make sure that the top context does not change when doing callbacks or // interceptor calls. AssertNoContextChange ncc; @@ -2873,7 +2877,7 @@ MaybeObject* JSObject::SetPropertyForResult(LookupResult* lookup, // Check access rights if needed. if (IsAccessCheckNeeded()) { - if (!heap->isolate()->MayNamedAccess(this, name_raw, v8::ACCESS_SET)) { + if (!isolate->MayNamedAccess(this, name_raw, v8::ACCESS_SET)) { return SetPropertyWithFailedAccessCheck( lookup, name_raw, value_raw, true, strict_mode); } @@ -2889,10 +2893,10 @@ MaybeObject* JSObject::SetPropertyForResult(LookupResult* lookup, // From this point on everything needs to be handlified, because // SetPropertyViaPrototypes might call back into JavaScript. - HandleScope scope(GetIsolate()); + HandleScope scope(isolate); Handle self(this); Handle name(name_raw); - Handle value(value_raw); + Handle value(value_raw, isolate); if (!lookup->IsProperty() && !self->IsJSContextExtensionObject()) { bool done = false; @@ -2910,16 +2914,16 @@ MaybeObject* JSObject::SetPropertyForResult(LookupResult* lookup, if (lookup->IsProperty() && lookup->IsReadOnly()) { if (strict_mode == kStrictMode) { Handle args[] = { name, self }; - return heap->isolate()->Throw(*heap->isolate()->factory()->NewTypeError( + return isolate->Throw(*isolate->factory()->NewTypeError( "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args)))); } else { return *value; } } - Handle old_value(heap->the_hole_value()); + Handle old_value(heap->the_hole_value(), isolate); if (FLAG_harmony_observation && map()->is_observed()) { - old_value = handle(lookup->GetLazyValue()); + old_value = handle(lookup->GetLazyValue(), isolate); } // This is a real property that is not read-only, or it is a @@ -2997,13 +3001,13 @@ MaybeObject* JSObject::SetPropertyForResult(LookupResult* lookup, } Handle hresult; - if (!result->ToHandle(&hresult)) return result; + if (!result->ToHandle(&hresult, isolate)) return result; if (FLAG_harmony_observation && map()->is_observed()) { if (lookup->IsTransition()) { EnqueueChangeRecord(self, "new", name, old_value); } else { - LookupResult new_lookup(self->GetIsolate()); + LookupResult new_lookup(isolate); self->LocalLookup(*name, &new_lookup); ASSERT(!new_lookup.GetLazyValue()->IsTheHole()); if (!new_lookup.GetLazyValue()->SameValue(*old_value)) { @@ -3076,15 +3080,15 @@ MaybeObject* JSObject::SetLocalPropertyIgnoreAttributes( } // From this point on everything needs to be handlified. - HandleScope scope(GetIsolate()); + HandleScope scope(isolate); Handle self(this); Handle name(name_raw); - Handle value(value_raw); + Handle value(value_raw, isolate); - Handle old_value(isolate->heap()->the_hole_value()); + Handle old_value(isolate->heap()->the_hole_value(), isolate); PropertyAttributes old_attributes = ABSENT; if (FLAG_harmony_observation && map()->is_observed()) { - old_value = handle(lookup.GetLazyValue()); + old_value = handle(lookup.GetLazyValue(), isolate); old_attributes = lookup.GetAttributes(); } @@ -3146,7 +3150,7 @@ MaybeObject* JSObject::SetLocalPropertyIgnoreAttributes( } Handle hresult; - if (!result->ToHandle(&hresult)) return result; + if (!result->ToHandle(&hresult, isolate)) return result; if (FLAG_harmony_observation && map()->is_observed()) { if (lookup.IsTransition()) { @@ -4153,7 +4157,7 @@ MaybeObject* JSObject::DeleteElement(uint32_t index, DeleteMode mode) { } Handle hresult; - if (!result->ToHandle(&hresult)) return result; + if (!result->ToHandle(&hresult, isolate)) return result; if (FLAG_harmony_observation && map()->is_observed()) { if (preexists && !self->HasLocalElement(index)) @@ -4218,7 +4222,7 @@ MaybeObject* JSObject::DeleteProperty(String* name, DeleteMode mode) { Handle old_value(isolate->heap()->the_hole_value()); if (FLAG_harmony_observation && map()->is_observed()) { - old_value = handle(lookup.GetLazyValue()); + old_value = handle(lookup.GetLazyValue(), isolate); } MaybeObject* result; @@ -4240,7 +4244,7 @@ MaybeObject* JSObject::DeleteProperty(String* name, DeleteMode mode) { } Handle hresult; - if (!result->ToHandle(&hresult)) return result; + if (!result->ToHandle(&hresult, isolate)) return result; if (FLAG_harmony_observation && map()->is_observed()) { if (!self->HasLocalProperty(*hname)) @@ -4878,7 +4882,7 @@ MaybeObject* JSObject::DefineAccessor(String* name_raw, if (!CanSetCallback(name_raw)) return isolate->heap()->undefined_value(); // From this point on everything needs to be handlified. - HandleScope scope(GetIsolate()); + HandleScope scope(isolate); Handle self(this); Handle name(name_raw); Handle getter(getter_raw); @@ -4899,7 +4903,7 @@ MaybeObject* JSObject::DefineAccessor(String* name_raw, LookupResult lookup(isolate); LocalLookup(*name, &lookup); preexists = lookup.IsProperty(); - if (preexists) old_value = handle(lookup.GetLazyValue()); + if (preexists) old_value = handle(lookup.GetLazyValue(), isolate); } } @@ -4908,7 +4912,7 @@ MaybeObject* JSObject::DefineAccessor(String* name_raw, self->DefinePropertyAccessor(*name, *getter, *setter, attributes); Handle hresult; - if (!result->ToHandle(&hresult)) return result; + if (!result->ToHandle(&hresult, isolate)) return result; if (FLAG_harmony_observation && map()->is_observed()) { const char* type = preexists ? "reconfigured" : "new"; @@ -9414,7 +9418,7 @@ MaybeObject* JSArray::SetElementsLength(Object* len) { MaybeObject* result = self->GetElementsAccessor()->SetLength(*self, *new_length_handle); Handle hresult; - if (!result->ToHandle(&hresult)) return result; + if (!result->ToHandle(&hresult, isolate)) return result; CHECK(self->length()->ToArrayIndex(&new_length)); if (old_length != new_length) { @@ -10375,7 +10379,7 @@ MaybeObject* JSObject::SetElement(uint32_t index, // Don't allow element properties to be redefined for external arrays. if (HasExternalArrayElements() && set_mode == DEFINE_PROPERTY) { Handle number = isolate->factory()->NewNumberFromUint(index); - Handle args[] = { handle(this), number }; + Handle args[] = { handle(this, isolate), number }; Handle error = isolate->factory()->NewTypeError( "redef_external_array_element", HandleVector(args, ARRAY_SIZE(args))); return isolate->Throw(*error); @@ -10410,7 +10414,7 @@ MaybeObject* JSObject::SetElement(uint32_t index, old_value = Object::GetElement(self, index); } else if (self->IsJSArray()) { // Store old array length in case adding an element grows the array. - old_length = handle(Handle::cast(self)->length()); + old_length = handle(Handle::cast(self)->length(), isolate); } // Check for lookup interceptor @@ -10421,7 +10425,7 @@ MaybeObject* JSObject::SetElement(uint32_t index, index, *value, attributes, strict_mode, check_prototype, set_mode); Handle hresult; - if (!result->ToHandle(&hresult)) return result; + if (!result->ToHandle(&hresult, isolate)) return result; Handle name = isolate->factory()->Uint32ToString(index); PropertyAttributes new_attributes = self->GetLocalElementAttribute(index); diff --git a/src/objects.h b/src/objects.h index 57b8ca28a3..ffc567b73a 100644 --- a/src/objects.h +++ b/src/objects.h @@ -789,9 +789,9 @@ class MaybeObject BASE_EMBEDDED { } template - inline bool ToHandle(Handle* obj) { + inline bool ToHandle(Handle* obj, Isolate* isolate) { if (IsFailure()) return false; - *obj = handle(T::cast(reinterpret_cast(this))); + *obj = handle(T::cast(reinterpret_cast(this)), isolate); return true; } diff --git a/src/parser.cc b/src/parser.cc index 502e1e64ed..16f41c2ab7 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -3203,7 +3203,8 @@ Expression* Parser::ParseUnaryExpression(bool* ok) { if (op == Token::NOT) { // Convert the literal to a boolean condition and negate it. bool condition = literal->ToBoolean()->IsTrue(); - Handle result(isolate()->heap()->ToBoolean(!condition)); + Handle result(isolate()->heap()->ToBoolean(!condition), + isolate()); return factory()->NewLiteral(result); } else if (literal->IsNumber()) { // Compute some expressions involving only number literals. diff --git a/src/runtime.cc b/src/runtime.cc index 5ce6a3cb53..bd2a7a2d14 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -3153,7 +3153,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithEmptyString( // Shortcut for simple non-regexp global replacements if (is_global && regexp->TypeTag() == JSRegExp::ATOM) { - Handle empty_string(HEAP->empty_string()); + Handle empty_string = isolate->factory()->empty_string(); if (subject->HasOnlyAsciiChars()) { return StringReplaceAtomRegExpWithString( isolate, diff --git a/src/stub-cache.cc b/src/stub-cache.cc index fcb8a4eede..1f708b3ca6 100644 --- a/src/stub-cache.cc +++ b/src/stub-cache.cc @@ -120,7 +120,8 @@ Handle StubCache::ComputeLoadNonexistent(Handle name, // name specific if there are global objects involved. Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NONEXISTENT); - Handle probe(receiver->map()->FindInCodeCache(*cache_name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*cache_name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); LoadStubCompiler compiler(isolate_); @@ -139,7 +140,8 @@ Handle StubCache::ComputeLoadField(Handle name, PropertyIndex field_index) { ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::FIELD); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); LoadStubCompiler compiler(isolate_); @@ -160,7 +162,8 @@ Handle StubCache::ComputeLoadCallback(Handle name, ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); LoadStubCompiler compiler(isolate_); @@ -180,7 +183,8 @@ Handle StubCache::ComputeLoadViaGetter(Handle name, ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); LoadStubCompiler compiler(isolate_); @@ -200,7 +204,8 @@ Handle StubCache::ComputeLoadConstant(Handle name, ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CONSTANT_FUNCTION); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); LoadStubCompiler compiler(isolate_); @@ -219,7 +224,8 @@ Handle StubCache::ComputeLoadInterceptor(Handle name, ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::INTERCEPTOR); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); LoadStubCompiler compiler(isolate_); @@ -245,7 +251,8 @@ Handle StubCache::ComputeLoadGlobal(Handle name, ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NORMAL); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); LoadStubCompiler compiler(isolate_); @@ -265,7 +272,8 @@ Handle StubCache::ComputeKeyedLoadField(Handle name, ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::FIELD); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); KeyedLoadStubCompiler compiler(isolate_); @@ -285,7 +293,8 @@ Handle StubCache::ComputeKeyedLoadConstant(Handle name, ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CONSTANT_FUNCTION); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); KeyedLoadStubCompiler compiler(isolate_); @@ -304,7 +313,8 @@ Handle StubCache::ComputeKeyedLoadInterceptor(Handle name, ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::INTERCEPTOR); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); KeyedLoadStubCompiler compiler(isolate_); @@ -324,7 +334,8 @@ Handle StubCache::ComputeKeyedLoadCallback( ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); KeyedLoadStubCompiler compiler(isolate_); @@ -341,7 +352,8 @@ Handle StubCache::ComputeKeyedLoadArrayLength(Handle name, Handle receiver) { Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); KeyedLoadStubCompiler compiler(isolate_); @@ -358,7 +370,7 @@ Handle StubCache::ComputeKeyedLoadStringLength(Handle name, Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); Handle map(receiver->map()); - Handle probe(map->FindInCodeCache(*name, flags)); + Handle probe(map->FindInCodeCache(*name, flags), isolate_); if (probe->IsCode()) return Handle::cast(probe); KeyedLoadStubCompiler compiler(isolate_); @@ -375,7 +387,8 @@ Handle StubCache::ComputeKeyedLoadFunctionPrototype( Handle receiver) { Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); KeyedLoadStubCompiler compiler(isolate_); @@ -396,7 +409,8 @@ Handle StubCache::ComputeStoreField(Handle name, (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; Code::Flags flags = Code::ComputeMonomorphicFlags( Code::STORE_IC, type, strict_mode); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); StoreStubCompiler compiler(isolate_, strict_mode); @@ -438,7 +452,7 @@ Handle StubCache::ComputeKeyedLoadOrStoreElement( UNREACHABLE(); break; } - Handle probe(receiver_map->FindInCodeCache(*name, flags)); + Handle probe(receiver_map->FindInCodeCache(*name, flags), isolate_); if (probe->IsCode()) return Handle::cast(probe); Handle code; @@ -490,7 +504,8 @@ Handle StubCache::ComputeStoreGlobal(Handle name, StrictModeFlag strict_mode) { Code::Flags flags = Code::ComputeMonomorphicFlags( Code::STORE_IC, Code::NORMAL, strict_mode); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); StoreStubCompiler compiler(isolate_, strict_mode); @@ -510,7 +525,8 @@ Handle StubCache::ComputeStoreCallback(Handle name, ASSERT(v8::ToCData
(callback->setter()) != 0); Code::Flags flags = Code::ComputeMonomorphicFlags( Code::STORE_IC, Code::CALLBACKS, strict_mode); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); StoreStubCompiler compiler(isolate_, strict_mode); @@ -530,7 +546,8 @@ Handle StubCache::ComputeStoreViaSetter(Handle name, StrictModeFlag strict_mode) { Code::Flags flags = Code::ComputeMonomorphicFlags( Code::STORE_IC, Code::CALLBACKS, strict_mode); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); StoreStubCompiler compiler(isolate_, strict_mode); @@ -548,7 +565,8 @@ Handle StubCache::ComputeStoreInterceptor(Handle name, StrictModeFlag strict_mode) { Code::Flags flags = Code::ComputeMonomorphicFlags( Code::STORE_IC, Code::INTERCEPTOR, strict_mode); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); StoreStubCompiler compiler(isolate_, strict_mode); @@ -568,7 +586,8 @@ Handle StubCache::ComputeKeyedStoreField(Handle name, (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; Code::Flags flags = Code::ComputeMonomorphicFlags( Code::KEYED_STORE_IC, type, strict_mode); - Handle probe(receiver->map()->FindInCodeCache(*name, flags)); + Handle probe(receiver->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); KeyedStoreStubCompiler compiler(isolate(), strict_mode, @@ -610,7 +629,8 @@ Handle StubCache::ComputeCallConstant(int argc, Code::Flags flags = Code::ComputeMonomorphicFlags(kind, Code::CONSTANT_FUNCTION, extra_state, cache_holder, argc); - Handle probe(map_holder->map()->FindInCodeCache(*name, flags)); + Handle probe(map_holder->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); @@ -648,7 +668,8 @@ Handle StubCache::ComputeCallField(int argc, Code::Flags flags = Code::ComputeMonomorphicFlags(kind, Code::FIELD, extra_state, cache_holder, argc); - Handle probe(map_holder->map()->FindInCodeCache(*name, flags)); + Handle probe(map_holder->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); @@ -685,7 +706,8 @@ Handle StubCache::ComputeCallInterceptor(int argc, Code::Flags flags = Code::ComputeMonomorphicFlags(kind, Code::INTERCEPTOR, extra_state, cache_holder, argc); - Handle probe(map_holder->map()->FindInCodeCache(*name, flags)); + Handle probe(map_holder->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder); @@ -715,7 +737,8 @@ Handle StubCache::ComputeCallGlobal(int argc, Code::Flags flags = Code::ComputeMonomorphicFlags(kind, Code::NORMAL, extra_state, cache_holder, argc); - Handle probe(map_holder->map()->FindInCodeCache(*name, flags)); + Handle probe(map_holder->map()->FindInCodeCache(*name, flags), + isolate_); if (probe->IsCode()) return Handle::cast(probe); CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder); diff --git a/src/type-info.cc b/src/type-info.cc index f97fb52af3..7a9a5de809 100644 --- a/src/type-info.cc +++ b/src/type-info.cc @@ -79,7 +79,7 @@ static uint32_t IdToKey(TypeFeedbackId ast_id) { Handle TypeFeedbackOracle::GetInfo(TypeFeedbackId ast_id) { int entry = dictionary_->FindEntry(IdToKey(ast_id)); return entry != UnseededNumberDictionary::kNotFound - ? Handle(dictionary_->ValueAt(entry)) + ? Handle(dictionary_->ValueAt(entry), isolate_) : Handle::cast(isolate_->factory()->undefined_value()); } diff --git a/src/variables.h b/src/variables.h index ba26b80472..bb35ee88b5 100644 --- a/src/variables.h +++ b/src/variables.h @@ -130,8 +130,8 @@ class Variable: public ZoneObject { bool is_arguments() const { return kind_ == ARGUMENTS; } // True if the variable is named eval and not known to be shadowed. - bool is_possibly_eval() const { - return IsVariable(FACTORY->eval_symbol()); + bool is_possibly_eval(Isolate* isolate) const { + return IsVariable(isolate->factory()->eval_symbol()); } Variable* local_if_not_shadowed() const { diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc index a62462bec4..6bab01bb85 100644 --- a/src/x64/full-codegen-x64.cc +++ b/src/x64/full-codegen-x64.cc @@ -119,7 +119,7 @@ void FullCodeGenerator::Generate() { handler_table_ = isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); profiling_counter_ = isolate()->factory()->NewJSGlobalPropertyCell( - Handle(Smi::FromInt(FLAG_interrupt_budget))); + Handle(Smi::FromInt(FLAG_interrupt_budget), isolate())); SetFunctionPosition(function()); Comment cmnt(masm_, "[ function compiled by full code generator"); @@ -2304,7 +2304,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { VariableProxy* proxy = callee->AsVariableProxy(); Property* property = callee->AsProperty(); - if (proxy != NULL && proxy->var()->is_possibly_eval()) { + if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { // In a call to eval, we first call %ResolvePossiblyDirectEval to // resolve the function we need to call and the receiver of the call. // Then we call the resolved function using the given arguments.