Commit 94c1058b authored by ager@chromium.org's avatar ager@chromium.org

Cleanup more isolate usage in ia32 files.

Review URL: http://codereview.chromium.org/6696107

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7367 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b97fc27c
......@@ -300,7 +300,7 @@ void Assembler::emit(uint32_t x) {
void Assembler::emit(Handle<Object> handle) {
// Verify all Objects referred by code are NOT in new space.
Object* obj = *handle;
ASSERT(!HEAP->InNewSpace(obj));
ASSERT(!isolate()->heap()->InNewSpace(obj));
if (obj->IsHeapObject()) {
emit(reinterpret_cast<intptr_t>(handle.location()),
RelocInfo::EMBEDDED_OBJECT);
......
......@@ -122,9 +122,10 @@ void CpuFeatures::Probe(bool portable) {
CodeDesc desc;
assm.GetCode(&desc);
Object* code;
{ MaybeObject* maybe_code = HEAP->CreateCode(desc,
Code::ComputeFlags(Code::STUB),
Handle<Code>::null());
{ MaybeObject* maybe_code =
assm.isolate()->heap()->CreateCode(desc,
Code::ComputeFlags(Code::STUB),
Handle<Code>::null());
if (!maybe_code->ToObject(&code)) return;
}
if (!code->IsCode()) return;
......@@ -2672,7 +2673,7 @@ void Assembler::GrowBuffer() {
// Some internal data structures overflow for very large buffers,
// they must ensure that kMaximalBufferSize is not too large.
if ((desc.buffer_size > kMaximalBufferSize) ||
(desc.buffer_size > HEAP->MaxOldGenerationSize())) {
(desc.buffer_size > isolate()->heap()->MaxOldGenerationSize())) {
V8::FatalProcessOutOfMemory("Assembler::GrowBuffer");
}
......
......@@ -185,7 +185,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// ebx: JSObject
// edi: start of next object
__ mov(Operand(ebx, JSObject::kMapOffset), eax);
__ mov(ecx, FACTORY->empty_fixed_array());
Factory* factory = masm->isolate()->factory();
__ mov(ecx, factory->empty_fixed_array());
__ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx);
__ mov(Operand(ebx, JSObject::kElementsOffset), ecx);
// Set extra fields in the newly allocated object.
......@@ -195,9 +196,9 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
{ Label loop, entry;
// To allow for truncation.
if (count_constructions) {
__ mov(edx, FACTORY->one_pointer_filler_map());
__ mov(edx, factory->one_pointer_filler_map());
} else {
__ mov(edx, FACTORY->undefined_value());
__ mov(edx, factory->undefined_value());
}
__ lea(ecx, Operand(ebx, JSObject::kHeaderSize));
__ jmp(&entry);
......@@ -253,7 +254,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// edi: FixedArray
// edx: number of elements
// ecx: start of next object
__ mov(eax, FACTORY->fixed_array_map());
__ mov(eax, factory->fixed_array_map());
__ mov(Operand(edi, FixedArray::kMapOffset), eax); // setup the map
__ SmiTag(edx);
__ mov(Operand(edi, FixedArray::kLengthOffset), edx); // and length
......@@ -263,7 +264,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// edi: FixedArray
// ecx: start of next object
{ Label loop, entry;
__ mov(edx, FACTORY->undefined_value());
__ mov(edx, factory->undefined_value());
__ lea(eax, Operand(edi, FixedArray::kHeaderSize));
__ jmp(&entry);
__ bind(&loop);
......@@ -562,12 +563,14 @@ void Builtins::Generate_NotifyOSR(MacroAssembler* masm) {
void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
Factory* factory = masm->isolate()->factory();
// 1. Make sure we have at least one argument.
{ Label done;
__ test(eax, Operand(eax));
__ j(not_zero, &done, taken);
__ pop(ebx);
__ push(Immediate(FACTORY->undefined_value()));
__ push(Immediate(factory->undefined_value()));
__ push(ebx);
__ inc(eax);
__ bind(&done);
......@@ -601,9 +604,9 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
__ test(ebx, Immediate(kSmiTagMask));
__ j(zero, &convert_to_object);
__ cmp(ebx, FACTORY->null_value());
__ cmp(ebx, factory->null_value());
__ j(equal, &use_global_receiver);
__ cmp(ebx, FACTORY->undefined_value());
__ cmp(ebx, factory->undefined_value());
__ j(equal, &use_global_receiver);
// We don't use IsObjectJSObjectType here because we jump on success.
......@@ -755,9 +758,10 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
// Compute the receiver in non-strict mode.
__ test(ebx, Immediate(kSmiTagMask));
__ j(zero, &call_to_object);
__ cmp(ebx, FACTORY->null_value());
Factory* factory = masm->isolate()->factory();
__ cmp(ebx, factory->null_value());
__ j(equal, &use_global_receiver);
__ cmp(ebx, FACTORY->undefined_value());
__ cmp(ebx, factory->undefined_value());
__ j(equal, &use_global_receiver);
// If given receiver is already a JavaScript object then there's no
......@@ -868,8 +872,9 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
// scratch1: initial map
// scratch2: start of next object
__ mov(FieldOperand(result, JSObject::kMapOffset), scratch1);
Factory* factory = masm->isolate()->factory();
__ mov(FieldOperand(result, JSArray::kPropertiesOffset),
FACTORY->empty_fixed_array());
factory->empty_fixed_array());
// Field JSArray::kElementsOffset is initialized later.
__ mov(FieldOperand(result, JSArray::kLengthOffset), Immediate(0));
......@@ -877,7 +882,7 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
// fixed array.
if (initial_capacity == 0) {
__ mov(FieldOperand(result, JSArray::kElementsOffset),
FACTORY->empty_fixed_array());
factory->empty_fixed_array());
return;
}
......@@ -894,7 +899,7 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
// scratch1: elements array
// scratch2: start of next object
__ mov(FieldOperand(scratch1, FixedArray::kMapOffset),
FACTORY->fixed_array_map());
factory->fixed_array_map());
__ mov(FieldOperand(scratch1, FixedArray::kLengthOffset),
Immediate(Smi::FromInt(initial_capacity)));
......@@ -905,7 +910,7 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
if (initial_capacity <= kLoopUnfoldLimit) {
// Use a scratch register here to have only one reloc info when unfolding
// the loop.
__ mov(scratch3, FACTORY->the_hole_value());
__ mov(scratch3, factory->the_hole_value());
for (int i = 0; i < initial_capacity; i++) {
__ mov(FieldOperand(scratch1,
FixedArray::kHeaderSize + i * kPointerSize),
......@@ -915,7 +920,7 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
Label loop, entry;
__ jmp(&entry);
__ bind(&loop);
__ mov(Operand(scratch1, 0), FACTORY->the_hole_value());
__ mov(Operand(scratch1, 0), factory->the_hole_value());
__ add(Operand(scratch1), Immediate(kPointerSize));
__ bind(&entry);
__ cmp(scratch1, Operand(scratch2));
......@@ -970,7 +975,8 @@ static void AllocateJSArray(MacroAssembler* masm,
// elements_array_end: start of next object
// array_size: size of array (smi)
__ mov(FieldOperand(result, JSObject::kMapOffset), elements_array);
__ mov(elements_array, FACTORY->empty_fixed_array());
Factory* factory = masm->isolate()->factory();
__ mov(elements_array, factory->empty_fixed_array());
__ mov(FieldOperand(result, JSArray::kPropertiesOffset), elements_array);
// Field JSArray::kElementsOffset is initialized later.
__ mov(FieldOperand(result, JSArray::kLengthOffset), array_size);
......@@ -989,7 +995,7 @@ static void AllocateJSArray(MacroAssembler* masm,
// elements_array_end: start of next object
// array_size: size of array (smi)
__ mov(FieldOperand(elements_array, FixedArray::kMapOffset),
FACTORY->fixed_array_map());
factory->fixed_array_map());
// For non-empty JSArrays the length of the FixedArray and the JSArray is the
// same.
__ mov(FieldOperand(elements_array, FixedArray::kLengthOffset), array_size);
......@@ -1001,7 +1007,7 @@ static void AllocateJSArray(MacroAssembler* masm,
__ SmiUntag(array_size);
__ lea(edi, Operand(elements_array,
FixedArray::kHeaderSize - kHeapObjectTag));
__ mov(eax, FACTORY->the_hole_value());
__ mov(eax, factory->the_hole_value());
__ cld();
// Do not use rep stos when filling less than kRepStosThreshold
// words.
......@@ -1342,7 +1348,8 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
__ mov(FieldOperand(eax, HeapObject::kMapOffset), ecx);
// Set properties and elements.
__ Set(ecx, Immediate(FACTORY->empty_fixed_array()));
Factory* factory = masm->isolate()->factory();
__ Set(ecx, Immediate(factory->empty_fixed_array()));
__ mov(FieldOperand(eax, JSObject::kPropertiesOffset), ecx);
__ mov(FieldOperand(eax, JSObject::kElementsOffset), ecx);
......@@ -1383,7 +1390,7 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
// Load the empty string into ebx, remove the receiver from the
// stack, and jump back to the case where the argument is a string.
__ bind(&no_arguments);
__ Set(ebx, Immediate(FACTORY->empty_string()));
__ Set(ebx, Immediate(factory->empty_string()));
__ pop(ecx);
__ lea(esp, Operand(esp, kPointerSize));
__ push(ecx);
......
This diff is collapsed.
......@@ -56,7 +56,8 @@ static void ZapCodeRange(Address start, Address end) {
void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) {
HandleScope scope;
Isolate* isolate = code->GetIsolate();
HandleScope scope(isolate);
// Compute the size of relocation information needed for the code
// patching in Deoptimizer::DeoptimizeFunction.
......@@ -103,7 +104,7 @@ void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) {
// Allocate new relocation info and copy old relocation to the end
// of the new relocation info array because relocation info is
// written and read backwards.
Factory* factory = code->GetIsolate()->factory();
Factory* factory = isolate->factory();
Handle<ByteArray> new_reloc =
factory->NewByteArray(reloc_length + padding, TENURED);
memcpy(new_reloc->GetDataStartAddress() + padding,
......@@ -131,11 +132,12 @@ void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) {
void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
HandleScope scope;
AssertNoAllocation no_allocation;
if (!function->IsOptimized()) return;
Isolate* isolate = function->GetIsolate();
HandleScope scope(isolate);
AssertNoAllocation no_allocation;
// Get the optimized code.
Code* code = function->code();
Address code_start_address = code->instruction_start();
......@@ -194,11 +196,12 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
// a non-live object in the extra space at the end of the former reloc info.
Address junk_address = reloc_info->address() + reloc_info->Size();
ASSERT(junk_address <= reloc_end_address);
HEAP->CreateFillerObjectAt(junk_address, reloc_end_address - junk_address);
isolate->heap()->CreateFillerObjectAt(junk_address,
reloc_end_address - junk_address);
// Add the deoptimizing code to the list.
DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code);
DeoptimizerData* data = code->GetIsolate()->deoptimizer_data();
DeoptimizerData* data = isolate->deoptimizer_data();
node->set_next(data->deoptimizing_code_list_);
data->deoptimizing_code_list_ = node;
......
......@@ -2097,7 +2097,7 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag,
if (arg_count > 0) {
__ push(Operand(esp, arg_count * kPointerSize));
} else {
__ push(Immediate(FACTORY->undefined_value()));
__ push(Immediate(isolate()->factory()->undefined_value()));
}
// Push the receiver of the enclosing function.
......@@ -2800,7 +2800,7 @@ void FullCodeGenerator::EmitMathPow(ZoneList<Expression*>* args) {
VisitForStackValue(args->at(0));
VisitForStackValue(args->at(1));
if (masm()->isolate()->cpu_features()->IsSupported(SSE2)) {
if (isolate()->cpu_features()->IsSupported(SSE2)) {
MathPowStub stub;
__ CallStub(&stub);
} else {
......@@ -3307,7 +3307,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(ZoneList<Expression*>* args) {
__ mov(array_length, FieldOperand(array, JSArray::kLengthOffset));
__ SmiUntag(array_length);
__ j(not_zero, &non_trivial_array);
__ mov(result_operand, FACTORY->empty_string());
__ mov(result_operand, isolate()->factory()->empty_string());
__ jmp(&done);
// Save the array length.
......@@ -3518,7 +3518,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(ZoneList<Expression*>* args) {
__ bind(&bailout);
__ mov(result_operand, FACTORY->undefined_value());
__ mov(result_operand, isolate()->factory()->undefined_value());
__ bind(&done);
__ mov(eax, result_operand);
// Drop temp values from the stack, and restore context register.
......@@ -4224,7 +4224,7 @@ void FullCodeGenerator::EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode) {
void FullCodeGenerator::EmitCallIC(Handle<Code> ic, JumpPatchSite* patch_site) {
Counters* counters = masm()->isolate()->counters();
Counters* counters = isolate()->counters();
switch (ic->kind()) {
case Code::LOAD_IC:
__ IncrementCounter(counters->named_load_full(), 1);
......
......@@ -45,7 +45,7 @@ MacroAssembler::MacroAssembler(void* buffer, int size)
: Assembler(buffer, size),
generating_stub_(false),
allow_stub_calls_(true),
code_object_(HEAP->undefined_value()) {
code_object_(isolate()->heap()->undefined_value()) {
}
......@@ -250,7 +250,7 @@ void MacroAssembler::AbortIfNotNumber(Register object) {
test(object, Immediate(kSmiTagMask));
j(zero, &ok);
cmp(FieldOperand(object, HeapObject::kMapOffset),
FACTORY->heap_number_map());
isolate()->factory()->heap_number_map());
Assert(equal, "Operand not a number");
bind(&ok);
}
......@@ -286,7 +286,7 @@ void MacroAssembler::EnterFrame(StackFrame::Type type) {
push(Immediate(Smi::FromInt(type)));
push(Immediate(CodeObject()));
if (emit_debug_code()) {
cmp(Operand(esp, 0), Immediate(FACTORY->undefined_value()));
cmp(Operand(esp, 0), Immediate(isolate()->factory()->undefined_value()));
Check(not_equal, "code object not properly patched");
}
}
......@@ -577,7 +577,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
push(scratch);
// Read the first word and compare to global_context_map.
mov(scratch, FieldOperand(scratch, HeapObject::kMapOffset));
cmp(scratch, FACTORY->global_context_map());
cmp(scratch, isolate()->factory()->global_context_map());
Check(equal, "JSGlobalObject::global_context should be a global context.");
pop(scratch);
}
......@@ -598,13 +598,13 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
// Check the context is a global context.
if (emit_debug_code()) {
cmp(holder_reg, FACTORY->null_value());
cmp(holder_reg, isolate()->factory()->null_value());
Check(not_equal, "JSGlobalProxy::context() should not be null.");
push(holder_reg);
// Read the first word and compare to global_context_map(),
mov(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset));
cmp(holder_reg, FACTORY->global_context_map());
cmp(holder_reg, isolate()->factory()->global_context_map());
Check(equal, "JSGlobalObject::global_context should be a global context.");
pop(holder_reg);
}
......@@ -843,7 +843,7 @@ void MacroAssembler::AllocateHeapNumber(Register result,
// Set the map.
mov(FieldOperand(result, HeapObject::kMapOffset),
Immediate(FACTORY->heap_number_map()));
Immediate(isolate()->factory()->heap_number_map()));
}
......@@ -873,7 +873,7 @@ void MacroAssembler::AllocateTwoByteString(Register result,
// Set the map, length and hash field.
mov(FieldOperand(result, HeapObject::kMapOffset),
Immediate(FACTORY->string_map()));
Immediate(isolate()->factory()->string_map()));
mov(scratch1, length);
SmiTag(scratch1);
mov(FieldOperand(result, String::kLengthOffset), scratch1);
......@@ -908,7 +908,7 @@ void MacroAssembler::AllocateAsciiString(Register result,
// Set the map, length and hash field.
mov(FieldOperand(result, HeapObject::kMapOffset),
Immediate(FACTORY->ascii_string_map()));
Immediate(isolate()->factory()->ascii_string_map()));
mov(scratch1, length);
SmiTag(scratch1);
mov(FieldOperand(result, String::kLengthOffset), scratch1);
......@@ -934,7 +934,7 @@ void MacroAssembler::AllocateAsciiString(Register result,
// Set the map, length and hash field.
mov(FieldOperand(result, HeapObject::kMapOffset),
Immediate(FACTORY->ascii_string_map()));
Immediate(isolate()->factory()->ascii_string_map()));
mov(FieldOperand(result, String::kLengthOffset),
Immediate(Smi::FromInt(length)));
mov(FieldOperand(result, String::kHashFieldOffset),
......@@ -956,7 +956,7 @@ void MacroAssembler::AllocateConsString(Register result,
// Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset),
Immediate(FACTORY->cons_string_map()));
Immediate(isolate()->factory()->cons_string_map()));
}
......@@ -974,7 +974,7 @@ void MacroAssembler::AllocateAsciiConsString(Register result,
// Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset),
Immediate(FACTORY->cons_ascii_string_map()));
Immediate(isolate()->factory()->cons_ascii_string_map()));
}
......@@ -1092,7 +1092,7 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
// If the prototype or initial map is the hole, don't return it and
// simply miss the cache instead. This will allow us to allocate a
// prototype object on-demand in the runtime system.
cmp(Operand(result), Immediate(FACTORY->the_hole_value()));
cmp(Operand(result), Immediate(isolate()->factory()->the_hole_value()));
j(equal, miss, not_taken);
// If the function does not have an initial map, we're done.
......@@ -1158,7 +1158,7 @@ void MacroAssembler::IllegalOperation(int num_arguments) {
if (num_arguments > 0) {
add(Operand(esp), Immediate(num_arguments * kPointerSize));
}
mov(eax, Immediate(FACTORY->undefined_value()));
mov(eax, Immediate(isolate()->factory()->undefined_value()));
}
......@@ -1229,7 +1229,7 @@ MaybeObject* MacroAssembler::TryCallRuntime(const Runtime::Function* f,
IllegalOperation(num_arguments);
// Since we did not call the stub, there was no allocation failure.
// Return some non-failure object.
return HEAP->undefined_value();
return isolate()->heap()->undefined_value();
}
// TODO(1236192): Most runtime routines don't need the number of
......@@ -1403,7 +1403,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(ApiFunction* function,
}
bind(&empty_handle);
// It was zero; the result is undefined.
mov(eax, FACTORY->undefined_value());
mov(eax, isolate()->factory()->undefined_value());
jmp(&prologue);
// HandleScope limit has changed. Delete allocated extensions.
......@@ -1664,7 +1664,7 @@ void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
if (emit_debug_code()) {
Label ok, fail;
CheckMap(map, FACTORY->meta_map(), &fail, false);
CheckMap(map, isolate()->factory()->meta_map(), &fail, false);
jmp(&ok);
bind(&fail);
Abort("Global functions must have initial map");
......@@ -1812,12 +1812,13 @@ void MacroAssembler::Assert(Condition cc, const char* msg) {
void MacroAssembler::AssertFastElements(Register elements) {
if (emit_debug_code()) {
Factory* factory = isolate()->factory();
Label ok;
cmp(FieldOperand(elements, HeapObject::kMapOffset),
Immediate(FACTORY->fixed_array_map()));
Immediate(factory->fixed_array_map()));
j(equal, &ok);
cmp(FieldOperand(elements, HeapObject::kMapOffset),
Immediate(FACTORY->fixed_cow_array_map()));
Immediate(factory->fixed_cow_array_map()));
j(equal, &ok);
Abort("JSObject with fast elements map has slow elements");
bind(&ok);
......@@ -1882,7 +1883,7 @@ void MacroAssembler::JumpIfNotNumber(Register reg,
if (emit_debug_code()) AbortIfSmi(reg);
if (!info.IsNumber()) {
cmp(FieldOperand(reg, HeapObject::kMapOffset),
FACTORY->heap_number_map());
isolate()->factory()->heap_number_map());
j(not_equal, on_not_number);
}
}
......
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