Isolates: Cleanup usage of FACTORY in code stubs and bootstrapper.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7611 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 26e2d5a8
...@@ -3707,6 +3707,7 @@ Persistent<Context> v8::Context::New( ...@@ -3707,6 +3707,7 @@ Persistent<Context> v8::Context::New(
// Create the environment. // Create the environment.
env = isolate->bootstrapper()->CreateEnvironment( env = isolate->bootstrapper()->CreateEnvironment(
isolate,
Utils::OpenHandle(*global_object), Utils::OpenHandle(*global_object),
proxy_template, proxy_template,
extensions); extensions);
......
...@@ -3678,7 +3678,7 @@ void InstanceofStub::Generate(MacroAssembler* masm) { ...@@ -3678,7 +3678,7 @@ void InstanceofStub::Generate(MacroAssembler* masm) {
__ b(ne, &slow); __ b(ne, &slow);
// Null is not instance of anything. // Null is not instance of anything.
__ cmp(scratch, Operand(FACTORY->null_value())); __ cmp(scratch, Operand(masm->isolate()->factory()->null_value()));
__ b(ne, &object_not_null); __ b(ne, &object_not_null);
__ mov(r0, Operand(Smi::FromInt(1))); __ mov(r0, Operand(Smi::FromInt(1)));
__ Ret(HasArgsInRegisters() ? 0 : 2); __ Ret(HasArgsInRegisters() ? 0 : 2);
...@@ -4176,7 +4176,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { ...@@ -4176,7 +4176,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
__ bind(&failure); __ bind(&failure);
// For failure and exception return null. // For failure and exception return null.
__ mov(r0, Operand(FACTORY->null_value())); __ mov(r0, Operand(masm->isolate()->factory()->null_value()));
__ add(sp, sp, Operand(4 * kPointerSize)); __ add(sp, sp, Operand(4 * kPointerSize));
__ Ret(); __ Ret();
...@@ -4247,6 +4247,8 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) { ...@@ -4247,6 +4247,8 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
const int kMaxInlineLength = 100; const int kMaxInlineLength = 100;
Label slowcase; Label slowcase;
Label done; Label done;
Factory* factory = masm->isolate()->factory();
__ ldr(r1, MemOperand(sp, kPointerSize * 2)); __ ldr(r1, MemOperand(sp, kPointerSize * 2));
STATIC_ASSERT(kSmiTag == 0); STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagSize == 1); STATIC_ASSERT(kSmiTagSize == 1);
...@@ -4281,7 +4283,7 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) { ...@@ -4281,7 +4283,7 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
// Interleave operations for better latency. // Interleave operations for better latency.
__ ldr(r2, ContextOperand(cp, Context::GLOBAL_INDEX)); __ ldr(r2, ContextOperand(cp, Context::GLOBAL_INDEX));
__ add(r3, r0, Operand(JSRegExpResult::kSize)); __ add(r3, r0, Operand(JSRegExpResult::kSize));
__ mov(r4, Operand(FACTORY->empty_fixed_array())); __ mov(r4, Operand(factory->empty_fixed_array()));
__ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset)); __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset));
__ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset));
__ ldr(r2, ContextOperand(r2, Context::REGEXP_RESULT_MAP_INDEX)); __ ldr(r2, ContextOperand(r2, Context::REGEXP_RESULT_MAP_INDEX));
...@@ -4302,13 +4304,13 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) { ...@@ -4302,13 +4304,13 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
// r5: Number of elements in array, untagged. // r5: Number of elements in array, untagged.
// Set map. // Set map.
__ mov(r2, Operand(FACTORY->fixed_array_map())); __ mov(r2, Operand(factory->fixed_array_map()));
__ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset));
// Set FixedArray length. // Set FixedArray length.
__ mov(r6, Operand(r5, LSL, kSmiTagSize)); __ mov(r6, Operand(r5, LSL, kSmiTagSize));
__ str(r6, FieldMemOperand(r3, FixedArray::kLengthOffset)); __ str(r6, FieldMemOperand(r3, FixedArray::kLengthOffset));
// Fill contents of fixed-array with the-hole. // Fill contents of fixed-array with the-hole.
__ mov(r2, Operand(FACTORY->the_hole_value())); __ mov(r2, Operand(factory->the_hole_value()));
__ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
// Fill fixed array elements with hole. // Fill fixed array elements with hole.
// r0: JSArray, tagged. // r0: JSArray, tagged.
......
This diff is collapsed.
...@@ -93,6 +93,7 @@ class Bootstrapper { ...@@ -93,6 +93,7 @@ class Bootstrapper {
// Creates a JavaScript Global Context with initial object graph. // Creates a JavaScript Global Context with initial object graph.
// The returned value is a global handle casted to V8Environment*. // The returned value is a global handle casted to V8Environment*.
Handle<Context> CreateEnvironment( Handle<Context> CreateEnvironment(
Isolate* isolate,
Handle<Object> global_object, Handle<Object> global_object,
v8::Handle<v8::ObjectTemplate> global_template, v8::Handle<v8::ObjectTemplate> global_template,
v8::ExtensionConfiguration* extensions); v8::ExtensionConfiguration* extensions);
......
...@@ -843,6 +843,7 @@ bool Debug::Load() { ...@@ -843,6 +843,7 @@ bool Debug::Load() {
HandleScope scope(isolate_); HandleScope scope(isolate_);
Handle<Context> context = Handle<Context> context =
isolate_->bootstrapper()->CreateEnvironment( isolate_->bootstrapper()->CreateEnvironment(
isolate_,
Handle<Object>::null(), Handle<Object>::null(),
v8::Handle<ObjectTemplate>(), v8::Handle<ObjectTemplate>(),
NULL); NULL);
......
...@@ -1120,23 +1120,25 @@ void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) { ...@@ -1120,23 +1120,25 @@ void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) {
GenerateAddStrings(masm); GenerateAddStrings(masm);
} }
Factory* factory = masm->isolate()->factory();
// Convert odd ball arguments to numbers. // Convert odd ball arguments to numbers.
NearLabel check, done; NearLabel check, done;
__ cmp(edx, FACTORY->undefined_value()); __ cmp(edx, factory->undefined_value());
__ j(not_equal, &check); __ j(not_equal, &check);
if (Token::IsBitOp(op_)) { if (Token::IsBitOp(op_)) {
__ xor_(edx, Operand(edx)); __ xor_(edx, Operand(edx));
} else { } else {
__ mov(edx, Immediate(FACTORY->nan_value())); __ mov(edx, Immediate(factory->nan_value()));
} }
__ jmp(&done); __ jmp(&done);
__ bind(&check); __ bind(&check);
__ cmp(eax, FACTORY->undefined_value()); __ cmp(eax, factory->undefined_value());
__ j(not_equal, &done); __ j(not_equal, &done);
if (Token::IsBitOp(op_)) { if (Token::IsBitOp(op_)) {
__ xor_(eax, Operand(eax)); __ xor_(eax, Operand(eax));
} else { } else {
__ mov(eax, Immediate(FACTORY->nan_value())); __ mov(eax, Immediate(factory->nan_value()));
} }
__ bind(&done); __ bind(&done);
......
...@@ -2330,9 +2330,10 @@ void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm, ...@@ -2330,9 +2330,10 @@ void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm,
// Heap::GetNumberStringCache. // Heap::GetNumberStringCache.
Label is_smi; Label is_smi;
Label load_result_from_cache; Label load_result_from_cache;
Factory* factory = masm->isolate()->factory();
if (!object_is_smi) { if (!object_is_smi) {
__ JumpIfSmi(object, &is_smi); __ JumpIfSmi(object, &is_smi);
__ CheckMap(object, FACTORY->heap_number_map(), not_found, true); __ CheckMap(object, factory->heap_number_map(), not_found, true);
STATIC_ASSERT(8 == kDoubleSize); STATIC_ASSERT(8 == kDoubleSize);
__ movl(scratch, FieldOperand(object, HeapNumber::kValueOffset + 4)); __ movl(scratch, FieldOperand(object, HeapNumber::kValueOffset + 4));
...@@ -2419,6 +2420,7 @@ void CompareStub::Generate(MacroAssembler* masm) { ...@@ -2419,6 +2420,7 @@ void CompareStub::Generate(MacroAssembler* masm) {
ASSERT(lhs_.is(no_reg) && rhs_.is(no_reg)); ASSERT(lhs_.is(no_reg) && rhs_.is(no_reg));
Label check_unequal_objects, done; Label check_unequal_objects, done;
Factory* factory = masm->isolate()->factory();
// Compare two smis if required. // Compare two smis if required.
if (include_smi_compare_) { if (include_smi_compare_) {
...@@ -2466,7 +2468,6 @@ void CompareStub::Generate(MacroAssembler* masm) { ...@@ -2466,7 +2468,6 @@ void CompareStub::Generate(MacroAssembler* masm) {
// Note: if cc_ != equal, never_nan_nan_ is not used. // Note: if cc_ != equal, never_nan_nan_ is not used.
// We cannot set rax to EQUAL until just before return because // We cannot set rax to EQUAL until just before return because
// rax must be unchanged on jump to not_identical. // rax must be unchanged on jump to not_identical.
if (never_nan_nan_ && (cc_ == equal)) { if (never_nan_nan_ && (cc_ == equal)) {
__ Set(rax, EQUAL); __ Set(rax, EQUAL);
__ ret(0); __ ret(0);
...@@ -2474,7 +2475,7 @@ void CompareStub::Generate(MacroAssembler* masm) { ...@@ -2474,7 +2475,7 @@ void CompareStub::Generate(MacroAssembler* masm) {
NearLabel heap_number; NearLabel heap_number;
// If it's not a heap number, then return equal for (in)equality operator. // If it's not a heap number, then return equal for (in)equality operator.
__ Cmp(FieldOperand(rdx, HeapObject::kMapOffset), __ Cmp(FieldOperand(rdx, HeapObject::kMapOffset),
FACTORY->heap_number_map()); factory->heap_number_map());
__ j(equal, &heap_number); __ j(equal, &heap_number);
if (cc_ != equal) { if (cc_ != equal) {
// Call runtime on identical JSObjects. Otherwise return equal. // Call runtime on identical JSObjects. Otherwise return equal.
...@@ -2519,7 +2520,7 @@ void CompareStub::Generate(MacroAssembler* masm) { ...@@ -2519,7 +2520,7 @@ void CompareStub::Generate(MacroAssembler* masm) {
// Check if the non-smi operand is a heap number. // Check if the non-smi operand is a heap number.
__ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset),
FACTORY->heap_number_map()); factory->heap_number_map());
// If heap number, handle it in the slow case. // If heap number, handle it in the slow case.
__ j(equal, &slow); __ j(equal, &slow);
// Return non-equal. ebx (the lower half of rbx) is not zero. // Return non-equal. ebx (the lower half of rbx) is not zero.
...@@ -3450,10 +3451,11 @@ void StringCharCodeAtGenerator::GenerateSlow( ...@@ -3450,10 +3451,11 @@ void StringCharCodeAtGenerator::GenerateSlow(
MacroAssembler* masm, const RuntimeCallHelper& call_helper) { MacroAssembler* masm, const RuntimeCallHelper& call_helper) {
__ Abort("Unexpected fallthrough to CharCodeAt slow case"); __ Abort("Unexpected fallthrough to CharCodeAt slow case");
Factory* factory = masm->isolate()->factory();
// Index is not a smi. // Index is not a smi.
__ bind(&index_not_smi_); __ bind(&index_not_smi_);
// If index is a heap number, try converting it to an integer. // If index is a heap number, try converting it to an integer.
__ CheckMap(index_, FACTORY->heap_number_map(), index_not_number_, true); __ CheckMap(index_, factory->heap_number_map(), index_not_number_, true);
call_helper.BeforeCall(masm); call_helper.BeforeCall(masm);
__ push(object_); __ push(object_);
__ push(index_); __ push(index_);
......
...@@ -650,6 +650,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn( ...@@ -650,6 +650,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(
Label leave_exit_frame; Label leave_exit_frame;
Label write_back; Label write_back;
Factory* factory = isolate()->factory();
ExternalReference next_address = ExternalReference next_address =
ExternalReference::handle_scope_next_address(); ExternalReference::handle_scope_next_address();
const int kNextOffset = 0; const int kNextOffset = 0;
...@@ -697,7 +698,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn( ...@@ -697,7 +698,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(
// Check if the function scheduled an exception. // Check if the function scheduled an exception.
movq(rsi, scheduled_exception_address); movq(rsi, scheduled_exception_address);
Cmp(Operand(rsi, 0), FACTORY->the_hole_value()); Cmp(Operand(rsi, 0), factory->the_hole_value());
j(not_equal, &promote_scheduled_exception); j(not_equal, &promote_scheduled_exception);
LeaveApiExitFrame(); LeaveApiExitFrame();
...@@ -712,7 +713,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn( ...@@ -712,7 +713,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(
bind(&empty_result); bind(&empty_result);
// It was zero; the result is undefined. // It was zero; the result is undefined.
Move(rax, FACTORY->undefined_value()); Move(rax, factory->undefined_value());
jmp(&prologue); jmp(&prologue);
// HandleScope limit has changed. Delete allocated extensions. // HandleScope limit has changed. Delete allocated extensions.
...@@ -1895,7 +1896,7 @@ void MacroAssembler::AbortIfNotNumber(Register object) { ...@@ -1895,7 +1896,7 @@ void MacroAssembler::AbortIfNotNumber(Register object) {
Condition is_smi = CheckSmi(object); Condition is_smi = CheckSmi(object);
j(is_smi, &ok); j(is_smi, &ok);
Cmp(FieldOperand(object, HeapObject::kMapOffset), Cmp(FieldOperand(object, HeapObject::kMapOffset),
FACTORY->heap_number_map()); isolate()->factory()->heap_number_map());
Assert(equal, "Operand not a number"); Assert(equal, "Operand not a number");
bind(&ok); bind(&ok);
} }
...@@ -2152,7 +2153,7 @@ void MacroAssembler::EnterFrame(StackFrame::Type type) { ...@@ -2152,7 +2153,7 @@ void MacroAssembler::EnterFrame(StackFrame::Type type) {
push(kScratchRegister); push(kScratchRegister);
if (emit_debug_code()) { if (emit_debug_code()) {
movq(kScratchRegister, movq(kScratchRegister,
FACTORY->undefined_value(), isolate()->factory()->undefined_value(),
RelocInfo::EMBEDDED_OBJECT); RelocInfo::EMBEDDED_OBJECT);
cmpq(Operand(rsp, 0), kScratchRegister); cmpq(Operand(rsp, 0), kScratchRegister);
Check(not_equal, "code object not properly patched"); Check(not_equal, "code object not properly patched");
...@@ -2320,7 +2321,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, ...@@ -2320,7 +2321,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
// Check the context is a global context. // Check the context is a global context.
if (emit_debug_code()) { if (emit_debug_code()) {
Cmp(FieldOperand(scratch, HeapObject::kMapOffset), Cmp(FieldOperand(scratch, HeapObject::kMapOffset),
FACTORY->global_context_map()); isolate()->factory()->global_context_map());
Check(equal, "JSGlobalObject::global_context should be a global context."); Check(equal, "JSGlobalObject::global_context should be a global context.");
} }
...@@ -2822,7 +2823,7 @@ void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, ...@@ -2822,7 +2823,7 @@ void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
movq(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); movq(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
if (emit_debug_code()) { if (emit_debug_code()) {
Label ok, fail; Label ok, fail;
CheckMap(map, FACTORY->meta_map(), &fail, false); CheckMap(map, isolate()->factory()->meta_map(), &fail, false);
jmp(&ok); jmp(&ok);
bind(&fail); bind(&fail);
Abort("Global functions must have initial map"); Abort("Global functions must have initial map");
......
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