Commit d495f493 authored by ager@chromium.org's avatar ager@chromium.org

Cleanup usage of HEAP and FACTORY in the cache stub compiler.

Review URL: http://codereview.chromium.org/6770011
Patch from Karl Klose <karlklose@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7423 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ecc21b99
...@@ -555,7 +555,7 @@ static void PushInterceptorArguments(MacroAssembler* masm, ...@@ -555,7 +555,7 @@ static void PushInterceptorArguments(MacroAssembler* masm,
JSObject* holder_obj) { JSObject* holder_obj) {
__ push(name); __ push(name);
InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor(); InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor();
ASSERT(!HEAP->InNewSpace(interceptor)); ASSERT(!masm->isolate()->heap()->InNewSpace(interceptor));
Register scratch = name; Register scratch = name;
__ mov(scratch, Operand(Handle<Object>(interceptor))); __ mov(scratch, Operand(Handle<Object>(interceptor)));
__ push(scratch); __ push(scratch);
...@@ -624,7 +624,7 @@ static MaybeObject* GenerateFastApiDirectCall(MacroAssembler* masm, ...@@ -624,7 +624,7 @@ static MaybeObject* GenerateFastApiDirectCall(MacroAssembler* masm,
// Pass the additional arguments FastHandleApiCall expects. // Pass the additional arguments FastHandleApiCall expects.
Object* call_data = optimization.api_call_info()->data(); Object* call_data = optimization.api_call_info()->data();
Handle<CallHandlerInfo> api_call_info_handle(optimization.api_call_info()); Handle<CallHandlerInfo> api_call_info_handle(optimization.api_call_info());
if (HEAP->InNewSpace(call_data)) { if (masm->isolate()->heap()->InNewSpace(call_data)) {
__ Move(r0, api_call_info_handle); __ Move(r0, api_call_info_handle);
__ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset)); __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset));
} else { } else {
...@@ -719,7 +719,7 @@ class CallInterceptorCompiler BASE_EMBEDDED { ...@@ -719,7 +719,7 @@ class CallInterceptorCompiler BASE_EMBEDDED {
name, name,
holder, holder,
miss); miss);
return HEAP->undefined_value(); return masm->isolate()->heap()->undefined_value();
} }
} }
...@@ -822,7 +822,7 @@ class CallInterceptorCompiler BASE_EMBEDDED { ...@@ -822,7 +822,7 @@ class CallInterceptorCompiler BASE_EMBEDDED {
FreeSpaceForFastApiCall(masm); FreeSpaceForFastApiCall(masm);
} }
return HEAP->undefined_value(); return masm->isolate()->heap()->undefined_value();
} }
void CompileRegular(MacroAssembler* masm, void CompileRegular(MacroAssembler* masm,
...@@ -1091,7 +1091,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object, ...@@ -1091,7 +1091,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object,
!current->IsJSGlobalObject() && !current->IsJSGlobalObject() &&
!current->IsJSGlobalProxy()) { !current->IsJSGlobalProxy()) {
if (!name->IsSymbol()) { if (!name->IsSymbol()) {
MaybeObject* maybe_lookup_result = HEAP->LookupSymbol(name); MaybeObject* maybe_lookup_result = heap()->LookupSymbol(name);
Object* lookup_result = NULL; // Initialization to please compiler. Object* lookup_result = NULL; // Initialization to please compiler.
if (!maybe_lookup_result->ToObject(&lookup_result)) { if (!maybe_lookup_result->ToObject(&lookup_result)) {
set_failure(Failure::cast(maybe_lookup_result)); set_failure(Failure::cast(maybe_lookup_result));
...@@ -1111,7 +1111,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object, ...@@ -1111,7 +1111,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object,
__ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); __ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
reg = holder_reg; // from now the object is in holder_reg reg = holder_reg; // from now the object is in holder_reg
__ ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); __ ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
} else if (HEAP->InNewSpace(prototype)) { } else if (heap()->InNewSpace(prototype)) {
// Get the map of the current object. // Get the map of the current object.
__ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); __ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
__ cmp(scratch1, Operand(Handle<Map>(current->map()))); __ cmp(scratch1, Operand(Handle<Map>(current->map())));
...@@ -1259,7 +1259,7 @@ MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object, ...@@ -1259,7 +1259,7 @@ MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object,
__ push(receiver); __ push(receiver);
__ mov(scratch2, sp); // scratch2 = AccessorInfo::args_ __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_
Handle<AccessorInfo> callback_handle(callback); Handle<AccessorInfo> callback_handle(callback);
if (HEAP->InNewSpace(callback_handle->data())) { if (heap()->InNewSpace(callback_handle->data())) {
__ Move(scratch3, callback_handle); __ Move(scratch3, callback_handle);
__ ldr(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset)); __ ldr(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset));
} else { } else {
...@@ -1477,7 +1477,7 @@ void CallStubCompiler::GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell, ...@@ -1477,7 +1477,7 @@ void CallStubCompiler::GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell,
__ ldr(r1, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset)); __ ldr(r1, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset));
// Check that the cell contains the same function. // Check that the cell contains the same function.
if (HEAP->InNewSpace(function)) { if (heap()->InNewSpace(function)) {
// We can't embed a pointer to a function in new space so we have // We can't embed a pointer to a function in new space so we have
// to verify that the shared function info is unchanged. This has // to verify that the shared function info is unchanged. This has
// the nice side effect that multiple closures based on the same // the nice side effect that multiple closures based on the same
...@@ -1560,7 +1560,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, ...@@ -1560,7 +1560,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object,
// ----------------------------------- // -----------------------------------
// If object is not an array, bail out to regular call. // If object is not an array, bail out to regular call.
if (!object->IsJSArray() || cell != NULL) return HEAP->undefined_value(); if (!object->IsJSArray() || cell != NULL) return heap()->undefined_value();
Label miss; Label miss;
...@@ -1720,7 +1720,7 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, ...@@ -1720,7 +1720,7 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object,
// ----------------------------------- // -----------------------------------
// If object is not an array, bail out to regular call. // If object is not an array, bail out to regular call.
if (!object->IsJSArray() || cell != NULL) return HEAP->undefined_value(); if (!object->IsJSArray() || cell != NULL) return heap()->undefined_value();
Label miss, return_undefined, call_builtin; Label miss, return_undefined, call_builtin;
...@@ -1806,7 +1806,7 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( ...@@ -1806,7 +1806,7 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall(
// ----------------------------------- // -----------------------------------
// If object is not a string, bail out to regular call. // If object is not a string, bail out to regular call.
if (!object->IsString() || cell != NULL) return HEAP->undefined_value(); if (!object->IsString() || cell != NULL) return heap()->undefined_value();
const int argc = arguments().immediate(); const int argc = arguments().immediate();
...@@ -1890,7 +1890,7 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall( ...@@ -1890,7 +1890,7 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall(
// ----------------------------------- // -----------------------------------
// If object is not a string, bail out to regular call. // If object is not a string, bail out to regular call.
if (!object->IsString() || cell != NULL) return HEAP->undefined_value(); if (!object->IsString() || cell != NULL) return heap()->undefined_value();
const int argc = arguments().immediate(); const int argc = arguments().immediate();
...@@ -1979,7 +1979,7 @@ MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall( ...@@ -1979,7 +1979,7 @@ MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall(
// If the object is not a JSObject or we got an unexpected number of // If the object is not a JSObject or we got an unexpected number of
// arguments, bail out to the regular call. // arguments, bail out to the regular call.
if (!object->IsJSObject() || argc != 1) return HEAP->undefined_value(); if (!object->IsJSObject() || argc != 1) return heap()->undefined_value();
Label miss; Label miss;
GenerateNameCheck(name, &miss); GenerateNameCheck(name, &miss);
...@@ -2048,8 +2048,9 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, ...@@ -2048,8 +2048,9 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
// -- sp[argc * 4] : receiver // -- sp[argc * 4] : receiver
// ----------------------------------- // -----------------------------------
if (!masm()->isolate()->cpu_features()->IsSupported(VFP3)) if (!masm()->isolate()->cpu_features()->IsSupported(VFP3)) {
return HEAP->undefined_value(); return heap()->undefined_value();
}
CpuFeatures::Scope scope_vfp3(VFP3); CpuFeatures::Scope scope_vfp3(VFP3);
...@@ -2057,7 +2058,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, ...@@ -2057,7 +2058,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
// If the object is not a JSObject or we got an unexpected number of // If the object is not a JSObject or we got an unexpected number of
// arguments, bail out to the regular call. // arguments, bail out to the regular call.
if (!object->IsJSObject() || argc != 1) return HEAP->undefined_value(); if (!object->IsJSObject() || argc != 1) return heap()->undefined_value();
Label miss, slow; Label miss, slow;
GenerateNameCheck(name, &miss); GenerateNameCheck(name, &miss);
...@@ -2199,7 +2200,7 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object, ...@@ -2199,7 +2200,7 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object,
// If the object is not a JSObject or we got an unexpected number of // If the object is not a JSObject or we got an unexpected number of
// arguments, bail out to the regular call. // arguments, bail out to the regular call.
if (!object->IsJSObject() || argc != 1) return HEAP->undefined_value(); if (!object->IsJSObject() || argc != 1) return heap()->undefined_value();
Label miss; Label miss;
GenerateNameCheck(name, &miss); GenerateNameCheck(name, &miss);
...@@ -2291,18 +2292,16 @@ MaybeObject* CallStubCompiler::CompileFastApiCall( ...@@ -2291,18 +2292,16 @@ MaybeObject* CallStubCompiler::CompileFastApiCall(
JSGlobalPropertyCell* cell, JSGlobalPropertyCell* cell,
JSFunction* function, JSFunction* function,
String* name) { String* name) {
Isolate* isolate = masm()->isolate(); Counters* counters = isolate()->counters();
Heap* heap = isolate->heap();
Counters* counters = isolate->counters();
ASSERT(optimization.is_simple_api_call()); ASSERT(optimization.is_simple_api_call());
// Bail out if object is a global object as we don't want to // Bail out if object is a global object as we don't want to
// repatch it to global receiver. // repatch it to global receiver.
if (object->IsGlobalObject()) return heap->undefined_value(); if (object->IsGlobalObject()) return heap()->undefined_value();
if (cell != NULL) return heap->undefined_value(); if (cell != NULL) return heap()->undefined_value();
int depth = optimization.GetPrototypeDepthOfExpectedType( int depth = optimization.GetPrototypeDepthOfExpectedType(
JSObject::cast(object), holder); JSObject::cast(object), holder);
if (depth == kInvalidProtoDepth) return heap->undefined_value(); if (depth == kInvalidProtoDepth) return heap()->undefined_value();
Label miss, miss_before_stack_reserved; Label miss, miss_before_stack_reserved;
...@@ -2802,7 +2801,7 @@ MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, ...@@ -2802,7 +2801,7 @@ MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name,
GenerateLoadMiss(masm(), Code::LOAD_IC); GenerateLoadMiss(masm(), Code::LOAD_IC);
// Return the generated code. // Return the generated code.
return GetCode(NONEXISTENT, HEAP->empty_string()); return GetCode(NONEXISTENT, heap()->empty_string());
} }
...@@ -3251,7 +3250,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreSpecialized( ...@@ -3251,7 +3250,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreSpecialized(
__ ldr(elements_reg, __ ldr(elements_reg,
FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
__ ldr(scratch, FieldMemOperand(elements_reg, HeapObject::kMapOffset)); __ ldr(scratch, FieldMemOperand(elements_reg, HeapObject::kMapOffset));
__ cmp(scratch, Operand(Handle<Map>(FACTORY->fixed_array_map()))); __ cmp(scratch, Operand(Handle<Map>(factory()->fixed_array_map())));
__ b(ne, &miss); __ b(ne, &miss);
// Check that the key is within bounds. // Check that the key is within bounds.
......
This diff is collapsed.
...@@ -64,7 +64,7 @@ Code* StubCache::Set(String* name, Map* map, Code* code) { ...@@ -64,7 +64,7 @@ Code* StubCache::Set(String* name, Map* map, Code* code) {
// Validate that the name does not move on scavenge, and that we // Validate that the name does not move on scavenge, and that we
// can use identity checks instead of string equality checks. // can use identity checks instead of string equality checks.
ASSERT(!isolate_->heap()->InNewSpace(name)); ASSERT(!heap()->InNewSpace(name));
ASSERT(name->IsSymbol()); ASSERT(name->IsSymbol());
// The state bits are not important to the hash function because // The state bits are not important to the hash function because
...@@ -108,10 +108,10 @@ MaybeObject* StubCache::ComputeLoadNonexistent(String* name, ...@@ -108,10 +108,10 @@ MaybeObject* StubCache::ComputeLoadNonexistent(String* name,
// there are global objects involved, we need to check global // there are global objects involved, we need to check global
// property cells in the stub and therefore the stub will be // property cells in the stub and therefore the stub will be
// specific to the name. // specific to the name.
String* cache_name = isolate_->heap()->empty_string(); String* cache_name = heap()->empty_string();
if (receiver->IsGlobalObject()) cache_name = name; if (receiver->IsGlobalObject()) cache_name = name;
JSObject* last = receiver; JSObject* last = receiver;
while (last->GetPrototype() != isolate_->heap()->null_value()) { while (last->GetPrototype() != heap()->null_value()) {
last = JSObject::cast(last->GetPrototype()); last = JSObject::cast(last->GetPrototype());
if (last->IsGlobalObject()) cache_name = name; if (last->IsGlobalObject()) cache_name = name;
} }
...@@ -466,7 +466,7 @@ MaybeObject* StubCache::ComputeKeyedLoadSpecialized(JSObject* receiver) { ...@@ -466,7 +466,7 @@ MaybeObject* StubCache::ComputeKeyedLoadSpecialized(JSObject* receiver) {
// keyed loads that are not array elements go through a generic builtin stub. // keyed loads that are not array elements go through a generic builtin stub.
Code::Flags flags = Code::Flags flags =
Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, NORMAL); Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, NORMAL);
String* name = isolate_->heap()->KeyedLoadSpecialized_symbol(); String* name = heap()->KeyedLoadSpecialized_symbol();
Object* code = receiver->map()->FindInCodeCache(name, flags); Object* code = receiver->map()->FindInCodeCache(name, flags);
if (code->IsUndefined()) { if (code->IsUndefined()) {
KeyedLoadStubCompiler compiler; KeyedLoadStubCompiler compiler;
...@@ -518,7 +518,7 @@ MaybeObject* StubCache::ComputeKeyedStoreSpecialized( ...@@ -518,7 +518,7 @@ MaybeObject* StubCache::ComputeKeyedStoreSpecialized(
StrictModeFlag strict_mode) { StrictModeFlag strict_mode) {
Code::Flags flags = Code::Flags flags =
Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL, strict_mode); Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL, strict_mode);
String* name = isolate_->heap()->KeyedStoreSpecialized_symbol(); String* name = heap()->KeyedStoreSpecialized_symbol();
Object* code = receiver->map()->FindInCodeCache(name, flags); Object* code = receiver->map()->FindInCodeCache(name, flags);
if (code->IsUndefined()) { if (code->IsUndefined()) {
KeyedStoreStubCompiler compiler(strict_mode); KeyedStoreStubCompiler compiler(strict_mode);
...@@ -563,26 +563,27 @@ ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) { ...@@ -563,26 +563,27 @@ ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) {
} }
} }
String* ExternalArrayTypeToStubName(ExternalArrayType array_type, String* ExternalArrayTypeToStubName(Heap* heap,
ExternalArrayType array_type,
bool is_store) { bool is_store) {
if (is_store) { if (is_store) {
switch (array_type) { switch (array_type) {
case kExternalByteArray: case kExternalByteArray:
return HEAP->KeyedStoreExternalByteArray_symbol(); return heap->KeyedStoreExternalByteArray_symbol();
case kExternalUnsignedByteArray: case kExternalUnsignedByteArray:
return HEAP->KeyedStoreExternalUnsignedByteArray_symbol(); return heap->KeyedStoreExternalUnsignedByteArray_symbol();
case kExternalShortArray: case kExternalShortArray:
return HEAP->KeyedStoreExternalShortArray_symbol(); return heap->KeyedStoreExternalShortArray_symbol();
case kExternalUnsignedShortArray: case kExternalUnsignedShortArray:
return HEAP->KeyedStoreExternalUnsignedShortArray_symbol(); return heap->KeyedStoreExternalUnsignedShortArray_symbol();
case kExternalIntArray: case kExternalIntArray:
return HEAP->KeyedStoreExternalIntArray_symbol(); return heap->KeyedStoreExternalIntArray_symbol();
case kExternalUnsignedIntArray: case kExternalUnsignedIntArray:
return HEAP->KeyedStoreExternalUnsignedIntArray_symbol(); return heap->KeyedStoreExternalUnsignedIntArray_symbol();
case kExternalFloatArray: case kExternalFloatArray:
return HEAP->KeyedStoreExternalFloatArray_symbol(); return heap->KeyedStoreExternalFloatArray_symbol();
case kExternalPixelArray: case kExternalPixelArray:
return HEAP->KeyedStoreExternalPixelArray_symbol(); return heap->KeyedStoreExternalPixelArray_symbol();
default: default:
UNREACHABLE(); UNREACHABLE();
return NULL; return NULL;
...@@ -590,21 +591,21 @@ String* ExternalArrayTypeToStubName(ExternalArrayType array_type, ...@@ -590,21 +591,21 @@ String* ExternalArrayTypeToStubName(ExternalArrayType array_type,
} else { } else {
switch (array_type) { switch (array_type) {
case kExternalByteArray: case kExternalByteArray:
return HEAP->KeyedLoadExternalByteArray_symbol(); return heap->KeyedLoadExternalByteArray_symbol();
case kExternalUnsignedByteArray: case kExternalUnsignedByteArray:
return HEAP->KeyedLoadExternalUnsignedByteArray_symbol(); return heap->KeyedLoadExternalUnsignedByteArray_symbol();
case kExternalShortArray: case kExternalShortArray:
return HEAP->KeyedLoadExternalShortArray_symbol(); return heap->KeyedLoadExternalShortArray_symbol();
case kExternalUnsignedShortArray: case kExternalUnsignedShortArray:
return HEAP->KeyedLoadExternalUnsignedShortArray_symbol(); return heap->KeyedLoadExternalUnsignedShortArray_symbol();
case kExternalIntArray: case kExternalIntArray:
return HEAP->KeyedLoadExternalIntArray_symbol(); return heap->KeyedLoadExternalIntArray_symbol();
case kExternalUnsignedIntArray: case kExternalUnsignedIntArray:
return HEAP->KeyedLoadExternalUnsignedIntArray_symbol(); return heap->KeyedLoadExternalUnsignedIntArray_symbol();
case kExternalFloatArray: case kExternalFloatArray:
return HEAP->KeyedLoadExternalFloatArray_symbol(); return heap->KeyedLoadExternalFloatArray_symbol();
case kExternalPixelArray: case kExternalPixelArray:
return HEAP->KeyedLoadExternalPixelArray_symbol(); return heap->KeyedLoadExternalPixelArray_symbol();
default: default:
UNREACHABLE(); UNREACHABLE();
return NULL; return NULL;
...@@ -627,7 +628,7 @@ MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray( ...@@ -627,7 +628,7 @@ MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray(
strict_mode); strict_mode);
ExternalArrayType array_type = ExternalArrayType array_type =
ElementsKindToExternalArrayType(receiver->GetElementsKind()); ElementsKindToExternalArrayType(receiver->GetElementsKind());
String* name = ExternalArrayTypeToStubName(array_type, is_store); String* name = ExternalArrayTypeToStubName(heap(), array_type, is_store);
Object* code = receiver->map()->FindInCodeCache(name, flags); Object* code = receiver->map()->FindInCodeCache(name, flags);
if (code->IsUndefined()) { if (code->IsUndefined()) {
ExternalArrayStubCompiler compiler; ExternalArrayStubCompiler compiler;
...@@ -759,7 +760,7 @@ MaybeObject* StubCache::ComputeKeyedStoreField(String* name, ...@@ -759,7 +760,7 @@ MaybeObject* StubCache::ComputeKeyedStoreField(String* name,
compiler.CompileStoreField(receiver, field_index, transition, name); compiler.CompileStoreField(receiver, field_index, transition, name);
if (!maybe_code->ToObject(&code)) return maybe_code; if (!maybe_code->ToObject(&code)) return maybe_code;
} }
PROFILE(isolate_, PROFILE(isolate(),
CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG,
Code::cast(code), name)); Code::cast(code), name));
GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code))); GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code)));
...@@ -917,7 +918,7 @@ MaybeObject* StubCache::ComputeCallInterceptor(int argc, ...@@ -917,7 +918,7 @@ MaybeObject* StubCache::ComputeCallInterceptor(int argc,
if (!maybe_code->ToObject(&code)) return maybe_code; if (!maybe_code->ToObject(&code)) return maybe_code;
} }
ASSERT_EQ(flags, Code::cast(code)->flags()); ASSERT_EQ(flags, Code::cast(code)->flags());
PROFILE(isolate_, PROFILE(isolate(),
CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG),
Code::cast(code), name)); Code::cast(code), name));
GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code)));
...@@ -975,7 +976,7 @@ MaybeObject* StubCache::ComputeCallGlobal(int argc, ...@@ -975,7 +976,7 @@ MaybeObject* StubCache::ComputeCallGlobal(int argc,
if (!maybe_code->ToObject(&code)) return maybe_code; if (!maybe_code->ToObject(&code)) return maybe_code;
} }
ASSERT_EQ(flags, Code::cast(code)->flags()); ASSERT_EQ(flags, Code::cast(code)->flags());
PROFILE(isolate_, PROFILE(isolate(),
CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG),
Code::cast(code), name)); Code::cast(code), name));
GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code)));
...@@ -1046,8 +1047,8 @@ Code* StubCache::FindCallInitialize(int argc, ...@@ -1046,8 +1047,8 @@ Code* StubCache::FindCallInitialize(int argc,
Code::kNoExtraICState, Code::kNoExtraICState,
NORMAL, NORMAL,
argc); argc);
Object* result = ProbeCache(isolate_, flags)->ToObjectUnchecked(); Object* result = ProbeCache(isolate(), flags)->ToObjectUnchecked();
ASSERT(result != isolate_->heap()->undefined_value()); ASSERT(result != heap()->undefined_value());
// This might be called during the marking phase of the collector // This might be called during the marking phase of the collector
// hence the unchecked cast. // hence the unchecked cast.
return reinterpret_cast<Code*>(result); return reinterpret_cast<Code*>(result);
...@@ -1219,12 +1220,12 @@ MaybeObject* StubCache::ComputeCallDebugPrepareStepIn(int argc, ...@@ -1219,12 +1220,12 @@ MaybeObject* StubCache::ComputeCallDebugPrepareStepIn(int argc,
void StubCache::Clear() { void StubCache::Clear() {
for (int i = 0; i < kPrimaryTableSize; i++) { for (int i = 0; i < kPrimaryTableSize; i++) {
primary_[i].key = isolate_->heap()->empty_string(); primary_[i].key = heap()->empty_string();
primary_[i].value = isolate_->builtins()->builtin( primary_[i].value = isolate_->builtins()->builtin(
Builtins::kIllegal); Builtins::kIllegal);
} }
for (int j = 0; j < kSecondaryTableSize; j++) { for (int j = 0; j < kSecondaryTableSize; j++) {
secondary_[j].key = isolate_->heap()->empty_string(); secondary_[j].key = heap()->empty_string();
secondary_[j].value = isolate_->builtins()->builtin( secondary_[j].value = isolate_->builtins()->builtin(
Builtins::kIllegal); Builtins::kIllegal);
} }
...@@ -1668,7 +1669,7 @@ MaybeObject* StubCompiler::GetCodeWithFlags(Code::Flags flags, ...@@ -1668,7 +1669,7 @@ MaybeObject* StubCompiler::GetCodeWithFlags(Code::Flags flags,
// Create code object in the heap. // Create code object in the heap.
CodeDesc desc; CodeDesc desc;
masm_.GetCode(&desc); masm_.GetCode(&desc);
MaybeObject* result = HEAP->CreateCode(desc, flags, masm_.CodeObject()); MaybeObject* result = heap()->CreateCode(desc, flags, masm_.CodeObject());
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
if (FLAG_print_code_stubs && !result->IsFailure()) { if (FLAG_print_code_stubs && !result->IsFailure()) {
Code::cast(result->ToObjectUnchecked())->Disassemble(name); Code::cast(result->ToObjectUnchecked())->Disassemble(name);
......
...@@ -322,6 +322,8 @@ class StubCache { ...@@ -322,6 +322,8 @@ class StubCache {
return NULL; return NULL;
} }
Isolate* isolate() { return isolate_; }
Heap* heap() { return isolate()->heap(); };
private: private:
explicit StubCache(Isolate* isolate); explicit StubCache(Isolate* isolate);
...@@ -559,6 +561,8 @@ class StubCompiler BASE_EMBEDDED { ...@@ -559,6 +561,8 @@ class StubCompiler BASE_EMBEDDED {
LookupResult* lookup); LookupResult* lookup);
Isolate* isolate() { return scope_.isolate(); } Isolate* isolate() { return scope_.isolate(); }
Heap* heap() { return isolate()->heap(); }
Factory* factory() { return isolate()->factory(); }
private: private:
HandleScope scope_; HandleScope scope_;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment