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.
......
...@@ -139,7 +139,7 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, ...@@ -139,7 +139,7 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
// Check that the properties array is a dictionary. // Check that the properties array is a dictionary.
__ cmp(FieldOperand(properties, HeapObject::kMapOffset), __ cmp(FieldOperand(properties, HeapObject::kMapOffset),
Immediate(FACTORY->hash_table_map())); Immediate(masm->isolate()->factory()->hash_table_map()));
__ j(not_equal, miss_label); __ j(not_equal, miss_label);
// Compute the capacity mask. // Compute the capacity mask.
...@@ -179,7 +179,7 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, ...@@ -179,7 +179,7 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
ASSERT_EQ(kSmiTagSize, 1); ASSERT_EQ(kSmiTagSize, 1);
__ mov(entity_name, Operand(properties, index, times_half_pointer_size, __ mov(entity_name, Operand(properties, index, times_half_pointer_size,
kElementsStartOffset - kHeapObjectTag)); kElementsStartOffset - kHeapObjectTag));
__ cmp(entity_name, FACTORY->undefined_value()); __ cmp(entity_name, masm->isolate()->factory()->undefined_value());
if (i != kProbes - 1) { if (i != kProbes - 1) {
__ j(equal, &done, taken); __ j(equal, &done, taken);
...@@ -860,10 +860,10 @@ MUST_USE_RESULT static MaybeObject* GenerateCheckPropertyCell( ...@@ -860,10 +860,10 @@ MUST_USE_RESULT static MaybeObject* GenerateCheckPropertyCell(
if (Serializer::enabled()) { if (Serializer::enabled()) {
__ mov(scratch, Immediate(Handle<Object>(cell))); __ mov(scratch, Immediate(Handle<Object>(cell)));
__ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset), __ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset),
Immediate(FACTORY->the_hole_value())); Immediate(masm->isolate()->factory()->the_hole_value()));
} else { } else {
__ cmp(Operand::Cell(Handle<JSGlobalPropertyCell>(cell)), __ cmp(Operand::Cell(Handle<JSGlobalPropertyCell>(cell)),
Immediate(FACTORY->the_hole_value())); Immediate(masm->isolate()->factory()->the_hole_value()));
} }
__ j(not_equal, miss, not_taken); __ j(not_equal, miss, not_taken);
return cell; return cell;
...@@ -916,8 +916,6 @@ Register StubCompiler::CheckPrototypes(JSObject* object, ...@@ -916,8 +916,6 @@ Register StubCompiler::CheckPrototypes(JSObject* object,
ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg)
&& !scratch2.is(scratch1)); && !scratch2.is(scratch1));
Heap* heap = isolate()->heap();
// Keep track of the current object in register reg. // Keep track of the current object in register reg.
Register reg = object_reg; Register reg = object_reg;
JSObject* current = object; JSObject* current = object;
...@@ -942,7 +940,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object, ...@@ -942,7 +940,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));
...@@ -962,7 +960,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object, ...@@ -962,7 +960,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object,
__ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); __ mov(scratch1, FieldOperand(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
__ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); __ mov(reg, FieldOperand(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.
__ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
__ cmp(Operand(scratch1), Immediate(Handle<Map>(current->map()))); __ cmp(Operand(scratch1), Immediate(Handle<Map>(current->map())));
...@@ -1216,7 +1214,7 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object, ...@@ -1216,7 +1214,7 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object,
// Check if interceptor provided a value for property. If it's // Check if interceptor provided a value for property. If it's
// the case, return immediately. // the case, return immediately.
Label interceptor_failed; Label interceptor_failed;
__ cmp(eax, FACTORY->no_interceptor_result_sentinel()); __ cmp(eax, factory()->no_interceptor_result_sentinel());
__ j(equal, &interceptor_failed); __ j(equal, &interceptor_failed);
__ LeaveInternalFrame(); __ LeaveInternalFrame();
__ ret(0); __ ret(0);
...@@ -1474,7 +1472,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, ...@@ -1474,7 +1472,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object,
// Check that the elements are in fast mode and writable. // Check that the elements are in fast mode and writable.
__ cmp(FieldOperand(ebx, HeapObject::kMapOffset), __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
Immediate(FACTORY->fixed_array_map())); Immediate(factory()->fixed_array_map()));
__ j(not_equal, &call_builtin); __ j(not_equal, &call_builtin);
if (argc == 1) { // Otherwise fall through to call builtin. if (argc == 1) { // Otherwise fall through to call builtin.
...@@ -1550,7 +1548,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, ...@@ -1550,7 +1548,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object,
// ... and fill the rest with holes. // ... and fill the rest with holes.
for (int i = 1; i < kAllocationDelta; i++) { for (int i = 1; i < kAllocationDelta; i++) {
__ mov(Operand(edx, i * kPointerSize), __ mov(Operand(edx, i * kPointerSize),
Immediate(FACTORY->the_hole_value())); Immediate(factory()->the_hole_value()));
} }
// Restore receiver to edx as finish sequence assumes it's here. // Restore receiver to edx as finish sequence assumes it's here.
...@@ -1596,7 +1594,7 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, ...@@ -1596,7 +1594,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) { if (!object->IsJSArray() || cell != NULL) {
return isolate()->heap()->undefined_value(); return heap()->undefined_value();
} }
Label miss, return_undefined, call_builtin; Label miss, return_undefined, call_builtin;
...@@ -1619,7 +1617,7 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, ...@@ -1619,7 +1617,7 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object,
// Check that the elements are in fast mode and writable. // Check that the elements are in fast mode and writable.
__ cmp(FieldOperand(ebx, HeapObject::kMapOffset), __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
Immediate(FACTORY->fixed_array_map())); Immediate(factory()->fixed_array_map()));
__ j(not_equal, &call_builtin); __ j(not_equal, &call_builtin);
// Get the array's length into ecx and calculate new length. // Get the array's length into ecx and calculate new length.
...@@ -1633,7 +1631,7 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, ...@@ -1633,7 +1631,7 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object,
__ mov(eax, FieldOperand(ebx, __ mov(eax, FieldOperand(ebx,
ecx, times_half_pointer_size, ecx, times_half_pointer_size,
FixedArray::kHeaderSize)); FixedArray::kHeaderSize));
__ cmp(Operand(eax), Immediate(FACTORY->the_hole_value())); __ cmp(Operand(eax), Immediate(factory()->the_hole_value()));
__ j(equal, &call_builtin); __ j(equal, &call_builtin);
// Set the array's length. // Set the array's length.
...@@ -1643,11 +1641,11 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, ...@@ -1643,11 +1641,11 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object,
__ mov(FieldOperand(ebx, __ mov(FieldOperand(ebx,
ecx, times_half_pointer_size, ecx, times_half_pointer_size,
FixedArray::kHeaderSize), FixedArray::kHeaderSize),
Immediate(FACTORY->the_hole_value())); Immediate(factory()->the_hole_value()));
__ ret((argc + 1) * kPointerSize); __ ret((argc + 1) * kPointerSize);
__ bind(&return_undefined); __ bind(&return_undefined);
__ mov(eax, Immediate(FACTORY->undefined_value())); __ mov(eax, Immediate(factory()->undefined_value()));
__ ret((argc + 1) * kPointerSize); __ ret((argc + 1) * kPointerSize);
__ bind(&call_builtin); __ bind(&call_builtin);
...@@ -1714,7 +1712,7 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( ...@@ -1714,7 +1712,7 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall(
if (argc > 0) { if (argc > 0) {
__ mov(index, Operand(esp, (argc - 0) * kPointerSize)); __ mov(index, Operand(esp, (argc - 0) * kPointerSize));
} else { } else {
__ Set(index, Immediate(FACTORY->undefined_value())); __ Set(index, Immediate(factory()->undefined_value()));
} }
StringCharCodeAtGenerator char_code_at_generator(receiver, StringCharCodeAtGenerator char_code_at_generator(receiver,
...@@ -1733,7 +1731,7 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( ...@@ -1733,7 +1731,7 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall(
if (index_out_of_range.is_linked()) { if (index_out_of_range.is_linked()) {
__ bind(&index_out_of_range); __ bind(&index_out_of_range);
__ Set(eax, Immediate(FACTORY->nan_value())); __ Set(eax, Immediate(factory()->nan_value()));
__ ret((argc + 1) * kPointerSize); __ ret((argc + 1) * kPointerSize);
} }
...@@ -1765,7 +1763,7 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall( ...@@ -1765,7 +1763,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) { if (!object->IsString() || cell != NULL) {
return isolate()->heap()->undefined_value(); return heap()->undefined_value();
} }
const int argc = arguments().immediate(); const int argc = arguments().immediate();
...@@ -1799,7 +1797,7 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall( ...@@ -1799,7 +1797,7 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall(
if (argc > 0) { if (argc > 0) {
__ mov(index, Operand(esp, (argc - 0) * kPointerSize)); __ mov(index, Operand(esp, (argc - 0) * kPointerSize));
} else { } else {
__ Set(index, Immediate(FACTORY->undefined_value())); __ Set(index, Immediate(factory()->undefined_value()));
} }
StringCharAtGenerator char_at_generator(receiver, StringCharAtGenerator char_at_generator(receiver,
...@@ -1819,7 +1817,7 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall( ...@@ -1819,7 +1817,7 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall(
if (index_out_of_range.is_linked()) { if (index_out_of_range.is_linked()) {
__ bind(&index_out_of_range); __ bind(&index_out_of_range);
__ Set(eax, Immediate(FACTORY->empty_string())); __ Set(eax, Immediate(factory()->empty_string()));
__ ret((argc + 1) * kPointerSize); __ ret((argc + 1) * kPointerSize);
} }
...@@ -1966,7 +1964,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, ...@@ -1966,7 +1964,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
// Check if the argument is a heap number and load its value into xmm0. // Check if the argument is a heap number and load its value into xmm0.
Label slow; Label slow;
__ CheckMap(eax, FACTORY->heap_number_map(), &slow, true); __ CheckMap(eax, factory()->heap_number_map(), &slow, true);
__ movdbl(xmm0, FieldOperand(eax, HeapNumber::kValueOffset)); __ movdbl(xmm0, FieldOperand(eax, HeapNumber::kValueOffset));
// Check if the argument is strictly positive. Note this also // Check if the argument is strictly positive. Note this also
...@@ -2110,7 +2108,7 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object, ...@@ -2110,7 +2108,7 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object,
// Check if the argument is a heap number and load its exponent and // Check if the argument is a heap number and load its exponent and
// sign into ebx. // sign into ebx.
__ bind(&not_smi); __ bind(&not_smi);
__ CheckMap(eax, FACTORY->heap_number_map(), &slow, true); __ CheckMap(eax, factory()->heap_number_map(), &slow, true);
__ mov(ebx, FieldOperand(eax, HeapNumber::kExponentOffset)); __ mov(ebx, FieldOperand(eax, HeapNumber::kExponentOffset));
// Check the sign of the argument. If the argument is positive, // Check the sign of the argument. If the argument is positive,
...@@ -2155,12 +2153,11 @@ MaybeObject* CallStubCompiler::CompileFastApiCall( ...@@ -2155,12 +2153,11 @@ MaybeObject* CallStubCompiler::CompileFastApiCall(
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.
Heap* heap = isolate()->heap(); 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;
...@@ -2311,9 +2308,9 @@ MaybeObject* CallStubCompiler::CompileCallConstant(Object* object, ...@@ -2311,9 +2308,9 @@ MaybeObject* CallStubCompiler::CompileCallConstant(Object* object,
} else { } else {
Label fast; Label fast;
// Check that the object is a boolean. // Check that the object is a boolean.
__ cmp(edx, FACTORY->true_value()); __ cmp(edx, factory()->true_value());
__ j(equal, &fast, taken); __ j(equal, &fast, taken);
__ cmp(edx, FACTORY->false_value()); __ cmp(edx, factory()->false_value());
__ j(not_equal, &miss, not_taken); __ j(not_equal, &miss, not_taken);
__ bind(&fast); __ bind(&fast);
// Check that the maps starting from the prototype haven't changed. // Check that the maps starting from the prototype haven't changed.
...@@ -2637,7 +2634,7 @@ MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, ...@@ -2637,7 +2634,7 @@ MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
// cell could have been deleted and reintroducing the global needs // cell could have been deleted and reintroducing the global needs
// to update the property details in the property dictionary of the // to update the property details in the property dictionary of the
// global object. We bail out to the runtime system to do that. // global object. We bail out to the runtime system to do that.
__ cmp(cell_operand, FACTORY->the_hole_value()); __ cmp(cell_operand, factory()->the_hole_value());
__ j(equal, &miss); __ j(equal, &miss);
// Store the value in the cell. // Store the value in the cell.
...@@ -2723,7 +2720,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreSpecialized( ...@@ -2723,7 +2720,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreSpecialized(
// Get the elements array and make sure it is a fast element array, not 'cow'. // Get the elements array and make sure it is a fast element array, not 'cow'.
__ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
__ cmp(FieldOperand(edi, HeapObject::kMapOffset), __ cmp(FieldOperand(edi, HeapObject::kMapOffset),
Immediate(FACTORY->fixed_array_map())); Immediate(factory()->fixed_array_map()));
__ j(not_equal, &miss, not_taken); __ j(not_equal, &miss, not_taken);
// Check that the key is within bounds. // Check that the key is within bounds.
...@@ -2935,10 +2932,10 @@ MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object, ...@@ -2935,10 +2932,10 @@ MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
// Check for deleted property if property can actually be deleted. // Check for deleted property if property can actually be deleted.
if (!is_dont_delete) { if (!is_dont_delete) {
__ cmp(ebx, FACTORY->the_hole_value()); __ cmp(ebx, factory()->the_hole_value());
__ j(equal, &miss, not_taken); __ j(equal, &miss, not_taken);
} else if (FLAG_debug_code) { } else if (FLAG_debug_code) {
__ cmp(ebx, FACTORY->the_hole_value()); __ cmp(ebx, factory()->the_hole_value());
__ Check(not_equal, "DontDelete cells can't contain the hole"); __ Check(not_equal, "DontDelete cells can't contain the hole");
} }
...@@ -3195,7 +3192,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadSpecialized(JSObject* receiver) { ...@@ -3195,7 +3192,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadSpecialized(JSObject* receiver) {
// Load the result and make sure it's not the hole. // Load the result and make sure it's not the hole.
__ mov(ebx, Operand(ecx, eax, times_2, __ mov(ebx, Operand(ecx, eax, times_2,
FixedArray::kHeaderSize - kHeapObjectTag)); FixedArray::kHeaderSize - kHeapObjectTag));
__ cmp(ebx, FACTORY->the_hole_value()); __ cmp(ebx, factory()->the_hole_value());
__ j(equal, &miss, not_taken); __ j(equal, &miss, not_taken);
__ mov(eax, ebx); __ mov(eax, ebx);
__ ret(0); __ ret(0);
...@@ -3224,7 +3221,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) { ...@@ -3224,7 +3221,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
// code for the function thereby hitting the break points. // code for the function thereby hitting the break points.
__ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
__ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kDebugInfoOffset)); __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kDebugInfoOffset));
__ cmp(ebx, FACTORY->undefined_value()); __ cmp(ebx, factory()->undefined_value());
__ j(not_equal, &generic_stub_call, not_taken); __ j(not_equal, &generic_stub_call, not_taken);
#endif #endif
...@@ -3261,7 +3258,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) { ...@@ -3261,7 +3258,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
// ebx: initial map // ebx: initial map
// edx: JSObject (untagged) // edx: JSObject (untagged)
__ mov(Operand(edx, JSObject::kMapOffset), ebx); __ mov(Operand(edx, JSObject::kMapOffset), ebx);
__ mov(ebx, FACTORY->empty_fixed_array()); __ mov(ebx, factory()->empty_fixed_array());
__ mov(Operand(edx, JSObject::kPropertiesOffset), ebx); __ mov(Operand(edx, JSObject::kPropertiesOffset), ebx);
__ mov(Operand(edx, JSObject::kElementsOffset), ebx); __ mov(Operand(edx, JSObject::kElementsOffset), ebx);
...@@ -3278,7 +3275,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) { ...@@ -3278,7 +3275,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
__ lea(ecx, Operand(esp, eax, times_4, 1 * kPointerSize)); __ lea(ecx, Operand(esp, eax, times_4, 1 * kPointerSize));
// Use edi for holding undefined which is used in several places below. // Use edi for holding undefined which is used in several places below.
__ mov(edi, FACTORY->undefined_value()); __ mov(edi, factory()->undefined_value());
// eax: argc // eax: argc
// ecx: first argument // ecx: first argument
...@@ -3593,7 +3590,7 @@ MaybeObject* ExternalArrayStubCompiler::CompileKeyedStoreStub( ...@@ -3593,7 +3590,7 @@ MaybeObject* ExternalArrayStubCompiler::CompileKeyedStoreStub(
// edi: elements array // edi: elements array
// ebx: untagged index // ebx: untagged index
__ cmp(FieldOperand(eax, HeapObject::kMapOffset), __ cmp(FieldOperand(eax, HeapObject::kMapOffset),
Immediate(FACTORY->heap_number_map())); Immediate(factory()->heap_number_map()));
__ j(not_equal, &slow); __ j(not_equal, &slow);
// The WebGL specification leaves the behavior of storing NaN and // The WebGL specification leaves the behavior of storing NaN and
......
...@@ -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_;
......
...@@ -153,7 +153,7 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, ...@@ -153,7 +153,7 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
ASSERT_EQ(kSmiTagSize, 1); ASSERT_EQ(kSmiTagSize, 1);
__ movq(entity_name, Operand(properties, index, times_pointer_size, __ movq(entity_name, Operand(properties, index, times_pointer_size,
kElementsStartOffset - kHeapObjectTag)); kElementsStartOffset - kHeapObjectTag));
__ Cmp(entity_name, FACTORY->undefined_value()); __ Cmp(entity_name, masm->isolate()->factory()->undefined_value());
// __ jmp(miss_label); // __ jmp(miss_label);
if (i != kProbes - 1) { if (i != kProbes - 1) {
__ j(equal, &done); __ j(equal, &done);
...@@ -380,7 +380,7 @@ static void PushInterceptorArguments(MacroAssembler* masm, ...@@ -380,7 +380,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));
__ Move(kScratchRegister, Handle<Object>(interceptor)); __ Move(kScratchRegister, Handle<Object>(interceptor));
__ push(kScratchRegister); __ push(kScratchRegister);
__ push(receiver); __ push(receiver);
...@@ -472,7 +472,7 @@ static MaybeObject* GenerateFastApiCall(MacroAssembler* masm, ...@@ -472,7 +472,7 @@ static MaybeObject* GenerateFastApiCall(MacroAssembler* masm,
__ movq(Operand(rsp, 2 * kPointerSize), rdi); __ movq(Operand(rsp, 2 * kPointerSize), rdi);
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(rcx, api_call_info_handle); __ Move(rcx, api_call_info_handle);
__ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset));
__ movq(Operand(rsp, 3 * kPointerSize), rbx); __ movq(Operand(rsp, 3 * kPointerSize), rbx);
...@@ -567,7 +567,7 @@ class CallInterceptorCompiler BASE_EMBEDDED { ...@@ -567,7 +567,7 @@ class CallInterceptorCompiler BASE_EMBEDDED {
name, name,
holder, holder,
miss); miss);
return HEAP->undefined_value(); // Success. return masm->isolate()->heap()->undefined_value(); // Success.
} }
} }
...@@ -667,7 +667,7 @@ class CallInterceptorCompiler BASE_EMBEDDED { ...@@ -667,7 +667,7 @@ class CallInterceptorCompiler BASE_EMBEDDED {
FreeSpaceForFastApiCall(masm, scratch1); FreeSpaceForFastApiCall(masm, scratch1);
} }
return HEAP->undefined_value(); // Success. return masm->isolate()->heap()->undefined_value(); // Success.
} }
void CompileRegular(MacroAssembler* masm, void CompileRegular(MacroAssembler* masm,
...@@ -847,7 +847,7 @@ MUST_USE_RESULT static MaybeObject* GenerateCheckPropertyCell( ...@@ -847,7 +847,7 @@ MUST_USE_RESULT static MaybeObject* GenerateCheckPropertyCell(
ASSERT(cell->value()->IsTheHole()); ASSERT(cell->value()->IsTheHole());
__ Move(scratch, Handle<Object>(cell)); __ Move(scratch, Handle<Object>(cell));
__ Cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset), __ Cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset),
FACTORY->the_hole_value()); masm->isolate()->factory()->the_hole_value());
__ j(not_equal, miss); __ j(not_equal, miss);
return cell; return cell;
} }
...@@ -896,7 +896,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object, ...@@ -896,7 +896,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object,
!current->IsJSGlobalObject() && !current->IsJSGlobalObject() &&
!current->IsJSGlobalProxy()) { !current->IsJSGlobalProxy()) {
if (!name->IsSymbol()) { if (!name->IsSymbol()) {
MaybeObject* lookup_result = HEAP->LookupSymbol(name); MaybeObject* lookup_result = heap()->LookupSymbol(name);
if (lookup_result->IsFailure()) { if (lookup_result->IsFailure()) {
set_failure(Failure::cast(lookup_result)); set_failure(Failure::cast(lookup_result));
return reg; return reg;
...@@ -916,7 +916,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object, ...@@ -916,7 +916,7 @@ Register StubCompiler::CheckPrototypes(JSObject* object,
__ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); __ movq(scratch1, FieldOperand(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
__ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); __ movq(reg, FieldOperand(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.
__ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); __ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
__ Cmp(scratch1, Handle<Map>(current->map())); __ Cmp(scratch1, Handle<Map>(current->map()));
...@@ -1050,7 +1050,7 @@ MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object, ...@@ -1050,7 +1050,7 @@ MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object,
__ push(receiver); // receiver __ push(receiver); // receiver
__ push(reg); // holder __ push(reg); // holder
if (HEAP->InNewSpace(callback_handle->data())) { if (heap()->InNewSpace(callback_handle->data())) {
__ Move(scratch1, callback_handle); __ Move(scratch1, callback_handle);
__ push(FieldOperand(scratch1, AccessorInfo::kDataOffset)); // data __ push(FieldOperand(scratch1, AccessorInfo::kDataOffset)); // data
} else { } else {
...@@ -1242,7 +1242,7 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object, ...@@ -1242,7 +1242,7 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object,
ExternalReference ref = ExternalReference ref =
ExternalReference(IC_Utility(IC::kLoadCallbackProperty), ExternalReference(IC_Utility(IC::kLoadCallbackProperty),
masm()->isolate()); isolate());
__ TailCallExternalReference(ref, 5, 1); __ TailCallExternalReference(ref, 5, 1);
} }
} else { // !compile_followup_inline } else { // !compile_followup_inline
...@@ -1257,7 +1257,7 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object, ...@@ -1257,7 +1257,7 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object,
__ push(scratch2); // restore old return address __ push(scratch2); // restore old return address
ExternalReference ref = ExternalReference( ExternalReference ref = ExternalReference(
IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), masm()->isolate()); IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate());
__ TailCallExternalReference(ref, 5, 1); __ TailCallExternalReference(ref, 5, 1);
} }
} }
...@@ -1303,7 +1303,7 @@ void CallStubCompiler::GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell, ...@@ -1303,7 +1303,7 @@ void CallStubCompiler::GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell,
__ movq(rdi, FieldOperand(rdi, JSGlobalPropertyCell::kValueOffset)); __ movq(rdi, FieldOperand(rdi, 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
...@@ -1325,7 +1325,7 @@ void CallStubCompiler::GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell, ...@@ -1325,7 +1325,7 @@ void CallStubCompiler::GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell,
MaybeObject* CallStubCompiler::GenerateMissBranch() { MaybeObject* CallStubCompiler::GenerateMissBranch() {
MaybeObject* maybe_obj = masm()->isolate()->stub_cache()->ComputeCallMiss( MaybeObject* maybe_obj = isolate()->stub_cache()->ComputeCallMiss(
arguments().immediate(), kind_); arguments().immediate(), kind_);
Object* obj; Object* obj;
if (!maybe_obj->ToObject(&obj)) return maybe_obj; if (!maybe_obj->ToObject(&obj)) return maybe_obj;
...@@ -1403,7 +1403,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, ...@@ -1403,7 +1403,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;
...@@ -1437,7 +1437,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, ...@@ -1437,7 +1437,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object,
// Check that the elements are in fast mode and writable. // Check that the elements are in fast mode and writable.
__ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset),
FACTORY->fixed_array_map()); factory()->fixed_array_map());
__ j(not_equal, &call_builtin); __ j(not_equal, &call_builtin);
if (argc == 1) { // Otherwise fall through to call builtin. if (argc == 1) { // Otherwise fall through to call builtin.
...@@ -1486,11 +1486,10 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, ...@@ -1486,11 +1486,10 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object,
__ jmp(&call_builtin); __ jmp(&call_builtin);
} }
Isolate* isolate = masm()->isolate();
ExternalReference new_space_allocation_top = 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 =
ExternalReference::new_space_allocation_limit_address(isolate); ExternalReference::new_space_allocation_limit_address(isolate());
const int kAllocationDelta = 4; const int kAllocationDelta = 4;
// Load top. // Load top.
...@@ -1537,7 +1536,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, ...@@ -1537,7 +1536,7 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object,
__ bind(&call_builtin); __ bind(&call_builtin);
__ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush, __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush,
masm()->isolate()), isolate()),
argc + 1, argc + 1,
1); 1);
} }
...@@ -1565,7 +1564,7 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, ...@@ -1565,7 +1564,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;
...@@ -1621,7 +1620,7 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, ...@@ -1621,7 +1620,7 @@ MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object,
__ bind(&call_builtin); __ bind(&call_builtin);
__ TailCallExternalReference( __ TailCallExternalReference(
ExternalReference(Builtins::c_ArrayPop, masm()->isolate()), ExternalReference(Builtins::c_ArrayPop, isolate()),
argc + 1, argc + 1,
1); 1);
...@@ -1649,7 +1648,7 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( ...@@ -1649,7 +1648,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();
...@@ -1731,7 +1730,7 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall( ...@@ -1731,7 +1730,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();
...@@ -1818,7 +1817,7 @@ MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall( ...@@ -1818,7 +1817,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);
...@@ -1875,7 +1874,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, ...@@ -1875,7 +1874,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
JSFunction* function, JSFunction* function,
String* name) { String* name) {
// TODO(872): implement this. // TODO(872): implement this.
return HEAP->undefined_value(); return heap()->undefined_value();
} }
...@@ -1896,7 +1895,7 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object, ...@@ -1896,7 +1895,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);
...@@ -1945,7 +1944,7 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object, ...@@ -1945,7 +1944,7 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object,
// Check if the argument is a heap number and load its value. // Check if the argument is a heap number and load its value.
__ bind(&not_smi); __ bind(&not_smi);
__ CheckMap(rax, FACTORY->heap_number_map(), &slow, true); __ CheckMap(rax, factory()->heap_number_map(), &slow, true);
__ movq(rbx, FieldOperand(rax, HeapNumber::kValueOffset)); __ movq(rbx, FieldOperand(rax, HeapNumber::kValueOffset));
// Check the sign of the argument. If the argument is positive, // Check the sign of the argument. If the argument is positive,
...@@ -1992,11 +1991,11 @@ MaybeObject* CallStubCompiler::CompileFastApiCall( ...@@ -1992,11 +1991,11 @@ MaybeObject* CallStubCompiler::CompileFastApiCall(
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;
...@@ -2009,7 +2008,7 @@ MaybeObject* CallStubCompiler::CompileFastApiCall( ...@@ -2009,7 +2008,7 @@ MaybeObject* CallStubCompiler::CompileFastApiCall(
// Check that the receiver isn't a smi. // Check that the receiver isn't a smi.
__ JumpIfSmi(rdx, &miss_before_stack_reserved); __ JumpIfSmi(rdx, &miss_before_stack_reserved);
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->call_const(), 1); __ IncrementCounter(counters->call_const(), 1);
__ IncrementCounter(counters->call_const_fast_api(), 1); __ IncrementCounter(counters->call_const_fast_api(), 1);
...@@ -2081,7 +2080,7 @@ MaybeObject* CallStubCompiler::CompileCallConstant(Object* object, ...@@ -2081,7 +2080,7 @@ MaybeObject* CallStubCompiler::CompileCallConstant(Object* object,
// unless we're doing a receiver map check. // unless we're doing a receiver map check.
ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK); ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK);
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
SharedFunctionInfo* function_info = function->shared(); SharedFunctionInfo* function_info = function->shared();
switch (check) { switch (check) {
case RECEIVER_MAP_CHECK: case RECEIVER_MAP_CHECK:
...@@ -2287,7 +2286,7 @@ MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, ...@@ -2287,7 +2286,7 @@ MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object,
__ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
// Jump to the cached code (tail call). // Jump to the cached code (tail call).
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->call_global_inline(), 1); __ IncrementCounter(counters->call_global_inline(), 1);
ASSERT(function->is_compiled()); ASSERT(function->is_compiled());
ParameterCount expected(function->shared()->formal_parameter_count()); ParameterCount expected(function->shared()->formal_parameter_count());
...@@ -2335,7 +2334,7 @@ MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object, ...@@ -2335,7 +2334,7 @@ MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object,
// Handle store cache miss. // Handle store cache miss.
__ bind(&miss); __ bind(&miss);
Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); Handle<Code> ic = isolate()->builtins()->StoreIC_Miss();
__ Jump(ic, RelocInfo::CODE_TARGET); __ Jump(ic, RelocInfo::CODE_TARGET);
// Return the generated code. // Return the generated code.
...@@ -2380,13 +2379,12 @@ MaybeObject* StoreStubCompiler::CompileStoreCallback(JSObject* object, ...@@ -2380,13 +2379,12 @@ MaybeObject* StoreStubCompiler::CompileStoreCallback(JSObject* object,
// Do tail-call to the runtime system. // Do tail-call to the runtime system.
ExternalReference store_callback_property = ExternalReference store_callback_property =
ExternalReference(IC_Utility(IC::kStoreCallbackProperty), ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
masm()->isolate());
__ TailCallExternalReference(store_callback_property, 4, 1); __ TailCallExternalReference(store_callback_property, 4, 1);
// Handle store cache miss. // Handle store cache miss.
__ bind(&miss); __ bind(&miss);
Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); Handle<Code> ic = isolate()->builtins()->StoreIC_Miss();
__ Jump(ic, RelocInfo::CODE_TARGET); __ Jump(ic, RelocInfo::CODE_TARGET);
// Return the generated code. // Return the generated code.
...@@ -2430,13 +2428,12 @@ MaybeObject* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, ...@@ -2430,13 +2428,12 @@ MaybeObject* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver,
// Do tail-call to the runtime system. // Do tail-call to the runtime system.
ExternalReference store_ic_property = ExternalReference store_ic_property =
ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate());
masm()->isolate());
__ TailCallExternalReference(store_ic_property, 4, 1); __ TailCallExternalReference(store_ic_property, 4, 1);
// Handle store cache miss. // Handle store cache miss.
__ bind(&miss); __ bind(&miss);
Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); Handle<Code> ic = isolate()->builtins()->StoreIC_Miss();
__ Jump(ic, RelocInfo::CODE_TARGET); __ Jump(ic, RelocInfo::CODE_TARGET);
// Return the generated code. // Return the generated code.
...@@ -2473,14 +2470,14 @@ MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, ...@@ -2473,14 +2470,14 @@ MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
__ movq(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), rax); __ movq(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), rax);
// Return the value (register rax). // Return the value (register rax).
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->named_store_global_inline(), 1); __ IncrementCounter(counters->named_store_global_inline(), 1);
__ ret(0); __ ret(0);
// Handle store cache miss. // Handle store cache miss.
__ bind(&miss); __ bind(&miss);
__ IncrementCounter(counters->named_store_global_inline_miss(), 1); __ IncrementCounter(counters->named_store_global_inline_miss(), 1);
Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); Handle<Code> ic = isolate()->builtins()->StoreIC_Miss();
__ Jump(ic, RelocInfo::CODE_TARGET); __ Jump(ic, RelocInfo::CODE_TARGET);
// Return the generated code. // Return the generated code.
...@@ -2500,7 +2497,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, ...@@ -2500,7 +2497,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
// ----------------------------------- // -----------------------------------
Label miss; Label miss;
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->keyed_store_field(), 1); __ IncrementCounter(counters->keyed_store_field(), 1);
// Check that the name has not changed. // Check that the name has not changed.
...@@ -2518,7 +2515,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, ...@@ -2518,7 +2515,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
// Handle store cache miss. // Handle store cache miss.
__ bind(&miss); __ bind(&miss);
__ DecrementCounter(counters->keyed_store_field(), 1); __ DecrementCounter(counters->keyed_store_field(), 1);
Handle<Code> ic = masm()->isolate()->builtins()->KeyedStoreIC_Miss(); Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss();
__ Jump(ic, RelocInfo::CODE_TARGET); __ Jump(ic, RelocInfo::CODE_TARGET);
// Return the generated code. // Return the generated code.
...@@ -2550,7 +2547,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreSpecialized( ...@@ -2550,7 +2547,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreSpecialized(
// Get the elements array and make sure it is a fast element array, not 'cow'. // Get the elements array and make sure it is a fast element array, not 'cow'.
__ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset));
__ Cmp(FieldOperand(rdi, HeapObject::kMapOffset), __ Cmp(FieldOperand(rdi, HeapObject::kMapOffset),
FACTORY->fixed_array_map()); factory()->fixed_array_map());
__ j(not_equal, &miss); __ j(not_equal, &miss);
// Check that the key is within bounds. // Check that the key is within bounds.
...@@ -2575,7 +2572,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreSpecialized( ...@@ -2575,7 +2572,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreSpecialized(
// Handle store cache miss. // Handle store cache miss.
__ bind(&miss); __ bind(&miss);
Handle<Code> ic = masm()->isolate()->builtins()->KeyedStoreIC_Miss(); Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss();
__ jmp(ic, RelocInfo::CODE_TARGET); __ jmp(ic, RelocInfo::CODE_TARGET);
// Return the generated code. // Return the generated code.
...@@ -2624,7 +2621,7 @@ MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, ...@@ -2624,7 +2621,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());
} }
...@@ -2763,7 +2760,7 @@ MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object, ...@@ -2763,7 +2760,7 @@ MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
__ Check(not_equal, "DontDelete cells can't contain the hole"); __ Check(not_equal, "DontDelete cells can't contain the hole");
} }
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->named_load_global_stub(), 1); __ IncrementCounter(counters->named_load_global_stub(), 1);
__ movq(rax, rbx); __ movq(rax, rbx);
__ ret(0); __ ret(0);
...@@ -2788,7 +2785,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name, ...@@ -2788,7 +2785,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name,
// ----------------------------------- // -----------------------------------
Label miss; Label miss;
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->keyed_load_field(), 1); __ IncrementCounter(counters->keyed_load_field(), 1);
// Check that the name has not changed. // Check that the name has not changed.
...@@ -2818,7 +2815,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback( ...@@ -2818,7 +2815,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback(
// ----------------------------------- // -----------------------------------
Label miss; Label miss;
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->keyed_load_callback(), 1); __ IncrementCounter(counters->keyed_load_callback(), 1);
// Check that the name has not changed. // Check that the name has not changed.
...@@ -2853,7 +2850,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name, ...@@ -2853,7 +2850,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
// ----------------------------------- // -----------------------------------
Label miss; Label miss;
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->keyed_load_constant_function(), 1); __ IncrementCounter(counters->keyed_load_constant_function(), 1);
// Check that the name has not changed. // Check that the name has not changed.
...@@ -2881,7 +2878,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, ...@@ -2881,7 +2878,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
// ----------------------------------- // -----------------------------------
Label miss; Label miss;
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->keyed_load_interceptor(), 1); __ IncrementCounter(counters->keyed_load_interceptor(), 1);
// Check that the name has not changed. // Check that the name has not changed.
...@@ -2917,7 +2914,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { ...@@ -2917,7 +2914,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
// ----------------------------------- // -----------------------------------
Label miss; Label miss;
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->keyed_load_array_length(), 1); __ IncrementCounter(counters->keyed_load_array_length(), 1);
// Check that the name has not changed. // Check that the name has not changed.
...@@ -2942,7 +2939,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { ...@@ -2942,7 +2939,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
// ----------------------------------- // -----------------------------------
Label miss; Label miss;
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->keyed_load_string_length(), 1); __ IncrementCounter(counters->keyed_load_string_length(), 1);
// Check that the name has not changed. // Check that the name has not changed.
...@@ -2967,7 +2964,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { ...@@ -2967,7 +2964,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
// ----------------------------------- // -----------------------------------
Label miss; Label miss;
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->keyed_load_function_prototype(), 1); __ IncrementCounter(counters->keyed_load_function_prototype(), 1);
// Check that the name has not changed. // Check that the name has not changed.
...@@ -3042,7 +3039,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) { ...@@ -3042,7 +3039,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
Label generic_stub_call; Label generic_stub_call;
// Use r8 for holding undefined which is used in several places below. // Use r8 for holding undefined which is used in several places below.
__ Move(r8, FACTORY->undefined_value()); __ Move(r8, factory()->undefined_value());
#ifdef ENABLE_DEBUGGER_SUPPORT #ifdef ENABLE_DEBUGGER_SUPPORT
// Check to see whether there are any break points in the function code. If // Check to see whether there are any break points in the function code. If
...@@ -3086,7 +3083,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) { ...@@ -3086,7 +3083,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
// rbx: initial map // rbx: initial map
// rdx: JSObject (untagged) // rdx: JSObject (untagged)
__ movq(Operand(rdx, JSObject::kMapOffset), rbx); __ movq(Operand(rdx, JSObject::kMapOffset), rbx);
__ Move(rbx, FACTORY->empty_fixed_array()); __ Move(rbx, factory()->empty_fixed_array());
__ movq(Operand(rdx, JSObject::kPropertiesOffset), rbx); __ movq(Operand(rdx, JSObject::kPropertiesOffset), rbx);
__ movq(Operand(rdx, JSObject::kElementsOffset), rbx); __ movq(Operand(rdx, JSObject::kElementsOffset), rbx);
...@@ -3145,7 +3142,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) { ...@@ -3145,7 +3142,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
__ pop(rcx); __ pop(rcx);
__ lea(rsp, Operand(rsp, rbx, times_pointer_size, 1 * kPointerSize)); __ lea(rsp, Operand(rsp, rbx, times_pointer_size, 1 * kPointerSize));
__ push(rcx); __ push(rcx);
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->constructed_objects(), 1); __ IncrementCounter(counters->constructed_objects(), 1);
__ IncrementCounter(counters->constructed_objects_stub(), 1); __ IncrementCounter(counters->constructed_objects_stub(), 1);
__ ret(0); __ ret(0);
...@@ -3154,7 +3151,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) { ...@@ -3154,7 +3151,7 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
// construction. // construction.
__ bind(&generic_stub_call); __ bind(&generic_stub_call);
Code* code = Code* code =
masm()->isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric); isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric);
Handle<Code> generic_construct_stub(code); Handle<Code> generic_construct_stub(code);
__ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
...@@ -3269,7 +3266,7 @@ MaybeObject* ExternalArrayStubCompiler::CompileKeyedLoadStub( ...@@ -3269,7 +3266,7 @@ MaybeObject* ExternalArrayStubCompiler::CompileKeyedLoadStub(
// Slow case: Jump to runtime. // Slow case: Jump to runtime.
__ bind(&slow); __ bind(&slow);
Counters* counters = masm()->isolate()->counters(); Counters* counters = isolate()->counters();
__ IncrementCounter(counters->keyed_load_external_array_slow(), 1); __ IncrementCounter(counters->keyed_load_external_array_slow(), 1);
// ----------- S t a t e ------------- // ----------- S t a t e -------------
......
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