Chromium Code Reviews| Index: src/ia32/stub-cache-ia32.cc |
| diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc |
| index c9f7a87c69146bdfa5427ccb6bc9e06a3336ed1e..78c2a53d53e462830fa3d60ccfa0be03850c550c 100644 |
| --- a/src/ia32/stub-cache-ia32.cc |
| +++ b/src/ia32/stub-cache-ia32.cc |
| @@ -400,7 +400,7 @@ static void PushInterceptorArguments(MacroAssembler* masm, |
| JSObject* holder_obj) { |
| __ push(name); |
| InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor(); |
| - ASSERT(!HEAP->InNewSpace(interceptor)); |
| + ASSERT(!masm->isolate()->heap()->InNewSpace(interceptor)); |
| Register scratch = name; |
| __ mov(scratch, Immediate(Handle<Object>(interceptor))); |
| __ push(scratch); |
| @@ -486,7 +486,7 @@ static MaybeObject* GenerateFastApiCall(MacroAssembler* masm, |
| __ mov(Operand(esp, 2 * kPointerSize), edi); |
| Object* call_data = optimization.api_call_info()->data(); |
| Handle<CallHandlerInfo> api_call_info_handle(optimization.api_call_info()); |
| - if (HEAP->InNewSpace(call_data)) { |
| + if (masm->isolate()->heap()->InNewSpace(call_data)) { |
| __ mov(ecx, api_call_info_handle); |
| __ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kDataOffset)); |
| __ mov(Operand(esp, 3 * kPointerSize), ebx); |
| @@ -580,7 +580,7 @@ class CallInterceptorCompiler BASE_EMBEDDED { |
| name, |
| holder, |
| miss); |
| - return HEAP->undefined_value(); // Success. |
| + return masm->isolate()->heap()->undefined_value(); // Success. |
| } |
| } |
| @@ -679,7 +679,7 @@ class CallInterceptorCompiler BASE_EMBEDDED { |
| FreeSpaceForFastApiCall(masm, scratch1); |
| } |
| - return HEAP->undefined_value(); // Success. |
| + return masm->isolate()->heap()->undefined_value(); // Success. |
| } |
| void CompileRegular(MacroAssembler* masm, |
| @@ -916,6 +916,9 @@ Register StubCompiler::CheckPrototypes(JSObject* object, |
| ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); |
| ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) |
| && !scratch2.is(scratch1)); |
| + |
| + Heap* heap = masm()->isolate()->heap(); |
|
Vitaly Repeshko
2011/03/25 12:57:51
There's StubCompiler::isolate() that we could use
Mads Ager (chromium)
2011/03/25 13:09:26
Great! Replaced a lot of occurences of masm->isola
|
| + |
| // Keep track of the current object in register reg. |
| Register reg = object_reg; |
| JSObject* current = object; |
| @@ -940,7 +943,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object, |
| !current->IsJSGlobalObject() && |
| !current->IsJSGlobalProxy()) { |
| 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. |
| if (!maybe_lookup_result->ToObject(&lookup_result)) { |
| set_failure(Failure::cast(maybe_lookup_result)); |
| @@ -960,7 +963,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object, |
| __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| reg = holder_reg; // from now the object is in holder_reg |
| __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
| - } else if (HEAP->InNewSpace(prototype)) { |
| + } else if (heap->InNewSpace(prototype)) { |
| // Get the map of the current object. |
| __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| __ cmp(Operand(scratch1), Immediate(Handle<Map>(current->map()))); |
| @@ -1090,7 +1093,7 @@ MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object, |
| ASSERT(!scratch2.is(reg)); |
| __ push(reg); // holder |
| // Push data from AccessorInfo. |
| - if (HEAP->InNewSpace(callback_handle->data())) { |
| + if (masm()->isolate()->heap()->InNewSpace(callback_handle->data())) { |
| __ mov(scratch1, Immediate(callback_handle)); |
| __ push(FieldOperand(scratch1, AccessorInfo::kDataOffset)); |
| } else { |
| @@ -1337,7 +1340,7 @@ void CallStubCompiler::GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell, |
| } |
| // Check that the cell contains the same function. |
| - if (HEAP->InNewSpace(function)) { |
| + if (masm()->isolate()->heap()->InNewSpace(function)) { |
| // 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 |
| // the nice side effect that multiple closures based on the same |
| @@ -1440,7 +1443,9 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, |
| // ----------------------------------- |
| // 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 masm()->isolate()->heap()->undefined_value(); |
| + } |
| Label miss; |
| @@ -1592,7 +1597,9 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, |
| // ----------------------------------- |
| // 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 masm()->isolate()->heap()->undefined_value(); |
| + } |
| Label miss, return_undefined, call_builtin; |
| @@ -1759,7 +1766,9 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall( |
| // ----------------------------------- |
| // 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 masm()->isolate()->heap()->undefined_value(); |
| + } |
| const int argc = arguments().immediate(); |
| @@ -1846,7 +1855,9 @@ MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall( |
| // If the object is not a JSObject or we got an unexpected number of |
| // arguments, bail out to the regular call. |
| - if (!object->IsJSObject() || argc != 1) return HEAP->undefined_value(); |
| + if (!object->IsJSObject() || argc != 1) { |
| + return masm()->isolate()->heap()->undefined_value(); |
| + } |
| Label miss; |
| GenerateNameCheck(name, &miss); |
| @@ -1914,15 +1925,19 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, |
| // -- esp[(argc + 1) * 4] : receiver |
| // ----------------------------------- |
| - if (masm()->isolate()->cpu_features()->IsSupported(SSE2)) |
| - return HEAP->undefined_value(); |
| + if (masm()->isolate()->cpu_features()->IsSupported(SSE2)) { |
| + return masm()->isolate()->heap()->undefined_value(); |
| + } |
| + |
| CpuFeatures::Scope use_sse2(SSE2); |
| const int argc = arguments().immediate(); |
| // If the object is not a JSObject or we got an unexpected number of |
| // arguments, bail out to the regular call. |
| - if (!object->IsJSObject() || argc != 1) return HEAP->undefined_value(); |
| + if (!object->IsJSObject() || argc != 1) { |
| + return masm()->isolate()->heap()->undefined_value(); |
| + } |
| Label miss; |
| GenerateNameCheck(name, &miss); |
| @@ -2044,7 +2059,9 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object, |
| // If the object is not a JSObject or we got an unexpected number of |
| // arguments, bail out to the regular call. |
| - if (!object->IsJSObject() || argc != 1) return HEAP->undefined_value(); |
| + if (!object->IsJSObject() || argc != 1) { |
| + return masm()->isolate()->heap()->undefined_value(); |
| + } |
| Label miss; |
| GenerateNameCheck(name, &miss); |
| @@ -2140,11 +2157,12 @@ MaybeObject* CallStubCompiler::CompileFastApiCall( |
| ASSERT(optimization.is_simple_api_call()); |
| // Bail out if object is a global object as we don't want to |
| // repatch it to global receiver. |
| - if (object->IsGlobalObject()) return HEAP->undefined_value(); |
| - if (cell != NULL) return HEAP->undefined_value(); |
| + Heap* heap = masm()->isolate()->heap(); |
| + if (object->IsGlobalObject()) return heap->undefined_value(); |
| + if (cell != NULL) return heap->undefined_value(); |
| int depth = optimization.GetPrototypeDepthOfExpectedType( |
| JSObject::cast(object), holder); |
| - if (depth == kInvalidProtoDepth) return HEAP->undefined_value(); |
| + if (depth == kInvalidProtoDepth) return heap->undefined_value(); |
| Label miss, miss_before_stack_reserved; |
| @@ -2750,6 +2768,8 @@ MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, |
| // ----------------------------------- |
| Label miss; |
| + Isolate* isolate = masm()->isolate(); |
| + |
| // Check that the receiver isn't a smi. |
| __ test(eax, Immediate(kSmiTagMask)); |
| __ j(zero, &miss, not_taken); |
| @@ -2777,14 +2797,14 @@ MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, |
| // Return undefined if maps of the full prototype chain are still the |
| // same and no global property with this name contains a value. |
| - __ mov(eax, FACTORY->undefined_value()); |
| + __ mov(eax, isolate->factory()->undefined_value()); |
| __ ret(0); |
| __ bind(&miss); |
| GenerateLoadMiss(masm(), Code::LOAD_IC); |
| // Return the generated code. |
| - return GetCode(NONEXISTENT, HEAP->empty_string()); |
| + return GetCode(NONEXISTENT, isolate->heap()->empty_string()); |
| } |