Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Unified Diff: src/ia32/full-codegen-ia32.cc

Issue 6542061: [Isolates] Less TLS reads in parser and full codegens. (Closed)
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen.cc ('k') | src/parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index 06e7612de82afe4e5dd847fe81265acb6493822a..303128a35645849e0de7e575432712ba9beb1e5b 100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -77,9 +77,9 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
{ Comment cmnt(masm_, "[ Allocate locals");
int locals_count = scope()->num_stack_slots();
if (locals_count == 1) {
- __ push(Immediate(FACTORY->undefined_value()));
+ __ push(Immediate(isolate()->factory()->undefined_value()));
} else if (locals_count > 1) {
- __ mov(eax, Immediate(FACTORY->undefined_value()));
+ __ mov(eax, Immediate(isolate()->factory()->undefined_value()));
for (int i = 0; i < locals_count; i++) {
__ push(eax);
}
@@ -192,7 +192,7 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
{ Comment cmnt(masm_, "[ return <undefined>;");
// Emit a 'return undefined' in case control fell off the end of the body.
- __ mov(eax, FACTORY->undefined_value());
+ __ mov(eax, isolate()->factory()->undefined_value());
EmitReturnSequence();
}
}
@@ -408,10 +408,10 @@ void FullCodeGenerator::AccumulatorValueContext::Plug(
Label* materialize_false) const {
NearLabel done;
__ bind(materialize_true);
- __ mov(result_register(), FACTORY->true_value());
+ __ mov(result_register(), isolate()->factory()->true_value());
__ jmp(&done);
__ bind(materialize_false);
- __ mov(result_register(), FACTORY->false_value());
+ __ mov(result_register(), isolate()->factory()->false_value());
__ bind(&done);
}
@@ -421,10 +421,10 @@ void FullCodeGenerator::StackValueContext::Plug(
Label* materialize_false) const {
NearLabel done;
__ bind(materialize_true);
- __ push(Immediate(FACTORY->true_value()));
+ __ push(Immediate(isolate()->factory()->true_value()));
__ jmp(&done);
__ bind(materialize_false);
- __ push(Immediate(FACTORY->false_value()));
+ __ push(Immediate(isolate()->factory()->false_value()));
__ bind(&done);
}
@@ -441,15 +441,17 @@ void FullCodeGenerator::EffectContext::Plug(bool flag) const {
void FullCodeGenerator::AccumulatorValueContext::Plug(bool flag) const {
- Handle<Object> value =
- flag ? FACTORY->true_value() : FACTORY->false_value();
+ Handle<Object> value = flag
+ ? isolate()->factory()->true_value()
+ : isolate()->factory()->false_value();
__ mov(result_register(), value);
}
void FullCodeGenerator::StackValueContext::Plug(bool flag) const {
- Handle<Object> value =
- flag ? FACTORY->true_value() : FACTORY->false_value();
+ Handle<Object> value = flag
+ ? isolate()->factory()->true_value()
+ : isolate()->factory()->false_value();
__ push(Immediate(value));
}
@@ -471,11 +473,11 @@ void FullCodeGenerator::DoTest(Label* if_true,
Label* if_false,
Label* fall_through) {
// Emit the inlined tests assumed by the stub.
- __ cmp(result_register(), FACTORY->undefined_value());
+ __ cmp(result_register(), isolate()->factory()->undefined_value());
__ j(equal, if_false);
- __ cmp(result_register(), FACTORY->true_value());
+ __ cmp(result_register(), isolate()->factory()->true_value());
__ j(equal, if_true);
- __ cmp(result_register(), FACTORY->false_value());
+ __ cmp(result_register(), isolate()->factory()->false_value());
__ j(equal, if_false);
ASSERT_EQ(0, kSmiTag);
__ test(result_register(), Operand(result_register()));
@@ -569,7 +571,7 @@ void FullCodeGenerator::PrepareForBailoutBeforeSplit(State state,
}
if (should_normalize) {
- __ cmp(eax, FACTORY->true_value());
+ __ cmp(eax, isolate()->factory()->true_value());
Split(equal, if_true, if_false, NULL);
__ bind(&skip);
}
@@ -589,7 +591,7 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable,
case Slot::LOCAL:
if (mode == Variable::CONST) {
__ mov(Operand(ebp, SlotOffset(slot)),
- Immediate(FACTORY->the_hole_value()));
+ Immediate(isolate()->factory()->the_hole_value()));
} else if (function != NULL) {
VisitForAccumulatorValue(function);
__ mov(Operand(ebp, SlotOffset(slot)), result_register());
@@ -610,7 +612,7 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable,
}
if (mode == Variable::CONST) {
__ mov(ContextOperand(esi, slot->index()),
- Immediate(FACTORY->the_hole_value()));
+ Immediate(isolate()->factory()->the_hole_value()));
// No write barrier since the hole value is in old space.
} else if (function != NULL) {
VisitForAccumulatorValue(function);
@@ -633,7 +635,7 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable,
// 'undefined') because we may have a (legal) redeclaration and we
// must not destroy the current value.
if (mode == Variable::CONST) {
- __ push(Immediate(FACTORY->the_hole_value()));
+ __ push(Immediate(isolate()->factory()->the_hole_value()));
} else if (function != NULL) {
VisitForStackValue(function);
} else {
@@ -656,11 +658,11 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable,
} else {
VisitForAccumulatorValue(prop->key());
__ mov(ecx, result_register());
- __ mov(result_register(), FACTORY->the_hole_value());
+ __ mov(result_register(), isolate()->factory()->the_hole_value());
}
__ pop(edx);
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::KeyedStoreIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
}
@@ -776,9 +778,9 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// ignore null and undefined in contrast to the specification; see
// ECMA-262 section 12.6.4.
VisitForAccumulatorValue(stmt->enumerable());
- __ cmp(eax, FACTORY->undefined_value());
+ __ cmp(eax, isolate()->factory()->undefined_value());
__ j(equal, &exit);
- __ cmp(eax, FACTORY->null_value());
+ __ cmp(eax, isolate()->factory()->null_value());
__ j(equal, &exit);
// Convert the object to a JS object.
@@ -804,7 +806,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// Check that there are no elements. Register ecx contains the
// current JS object we've reached through the prototype chain.
__ cmp(FieldOperand(ecx, JSObject::kElementsOffset),
- FACTORY->empty_fixed_array());
+ isolate()->factory()->empty_fixed_array());
__ j(not_equal, &call_runtime);
// Check that instance descriptors are not empty so that we can
@@ -812,7 +814,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// prototype load.
__ mov(ebx, FieldOperand(ecx, HeapObject::kMapOffset));
__ mov(edx, FieldOperand(ebx, Map::kInstanceDescriptorsOffset));
- __ cmp(edx, FACTORY->empty_descriptor_array());
+ __ cmp(edx, isolate()->factory()->empty_descriptor_array());
__ j(equal, &call_runtime);
// Check that there in an enum cache in the non-empty instance
@@ -827,13 +829,13 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ cmp(ecx, Operand(eax));
__ j(equal, &check_prototype);
__ mov(edx, FieldOperand(edx, DescriptorArray::kEnumCacheBridgeCacheOffset));
- __ cmp(edx, FACTORY->empty_fixed_array());
+ __ cmp(edx, isolate()->factory()->empty_fixed_array());
__ j(not_equal, &call_runtime);
// Load the prototype from the map and loop if non-null.
__ bind(&check_prototype);
__ mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset));
- __ cmp(ecx, FACTORY->null_value());
+ __ cmp(ecx, isolate()->factory()->null_value());
__ j(not_equal, &next);
// The enum cache is valid. Load the map of the object being
@@ -851,7 +853,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// modification check. Otherwise, we got a fixed array, and we have
// to do a slow check.
NearLabel fixed_array;
- __ cmp(FieldOperand(eax, HeapObject::kMapOffset), FACTORY->meta_map());
+ __ cmp(FieldOperand(eax, HeapObject::kMapOffset),
+ isolate()->factory()->meta_map());
__ j(not_equal, &fixed_array);
// We got a map in register eax. Get the enumeration cache from it.
@@ -955,8 +958,8 @@ void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info,
__ push(esi);
__ push(Immediate(info));
__ push(Immediate(pretenure
- ? FACTORY->true_value()
- : FACTORY->false_value()));
+ ? isolate()->factory()->true_value()
+ : isolate()->factory()->false_value()));
__ CallRuntime(Runtime::kNewClosure, 3);
}
context()->Plug(eax);
@@ -1008,7 +1011,7 @@ void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
__ bind(&next);
// Terminate at global context.
__ cmp(FieldOperand(temp, HeapObject::kMapOffset),
- Immediate(FACTORY->global_context_map()));
+ Immediate(isolate()->factory()->global_context_map()));
__ j(equal, &fast);
// Check that extension is NULL.
__ cmp(ContextOperand(temp, Context::EXTENSION_INDEX), Immediate(0));
@@ -1024,7 +1027,7 @@ void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
// load IC call.
__ mov(eax, GlobalObjectOperand());
__ mov(ecx, slot->var()->name());
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::LoadIC_Initialize));
RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF)
? RelocInfo::CODE_TARGET
@@ -1083,9 +1086,9 @@ void FullCodeGenerator::EmitDynamicLoadFromSlotFastCase(
__ mov(eax,
ContextSlotOperandCheckExtensions(potential_slot, slow));
if (potential_slot->var()->mode() == Variable::CONST) {
- __ cmp(eax, FACTORY->the_hole_value());
+ __ cmp(eax, isolate()->factory()->the_hole_value());
__ j(not_equal, done);
- __ mov(eax, FACTORY->undefined_value());
+ __ mov(eax, isolate()->factory()->undefined_value());
}
__ jmp(done);
} else if (rewrite != NULL) {
@@ -1105,7 +1108,7 @@ void FullCodeGenerator::EmitDynamicLoadFromSlotFastCase(
ContextSlotOperandCheckExtensions(obj_proxy->var()->AsSlot(),
slow));
__ mov(eax, Immediate(key_literal->handle()));
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::KeyedLoadIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
__ jmp(done);
@@ -1129,7 +1132,7 @@ void FullCodeGenerator::EmitVariableLoad(Variable* var) {
// object on the stack.
__ mov(eax, GlobalObjectOperand());
__ mov(ecx, var->name());
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::LoadIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT);
context()->Plug(eax);
@@ -1160,9 +1163,9 @@ void FullCodeGenerator::EmitVariableLoad(Variable* var) {
NearLabel done;
MemOperand slot_operand = EmitSlotSearch(slot, eax);
__ mov(eax, slot_operand);
- __ cmp(eax, FACTORY->the_hole_value());
+ __ cmp(eax, isolate()->factory()->the_hole_value());
__ j(not_equal, &done);
- __ mov(eax, FACTORY->undefined_value());
+ __ mov(eax, isolate()->factory()->undefined_value());
__ bind(&done);
context()->Plug(eax);
} else {
@@ -1193,7 +1196,7 @@ void FullCodeGenerator::EmitVariableLoad(Variable* var) {
__ mov(eax, Immediate(key_literal->handle()));
// Do a keyed property load.
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::KeyedLoadIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
@@ -1216,7 +1219,7 @@ void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
int literal_offset =
FixedArray::kHeaderSize + expr->literal_index() * kPointerSize;
__ mov(ebx, FieldOperand(ecx, literal_offset));
- __ cmp(ebx, FACTORY->undefined_value());
+ __ cmp(ebx, isolate()->factory()->undefined_value());
__ j(not_equal, &materialized);
// Create regexp literal using runtime function
@@ -1299,7 +1302,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForAccumulatorValue(value);
__ mov(ecx, Immediate(key->handle()));
__ mov(edx, Operand(esp, 0));
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::StoreIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
PrepareForBailoutForId(key->id(), NO_REGISTERS);
@@ -1351,12 +1354,13 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
__ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
__ push(Immediate(Smi::FromInt(expr->literal_index())));
__ push(Immediate(expr->constant_elements()));
- if (expr->constant_elements()->map() == HEAP->fixed_cow_array_map()) {
+ if (expr->constant_elements()->map() ==
+ isolate()->heap()->fixed_cow_array_map()) {
ASSERT(expr->depth() == 1);
FastCloneShallowArrayStub stub(
FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length);
__ CallStub(&stub);
- __ IncrementCounter(COUNTERS->cow_arrays_created_stub(), 1);
+ __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1);
} else if (expr->depth() > 1) {
__ CallRuntime(Runtime::kCreateArrayLiteral, 3);
} else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
@@ -1542,7 +1546,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
SetSourcePosition(prop->position());
Literal* key = prop->key()->AsLiteral();
__ mov(ecx, Immediate(key->handle()));
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::LoadIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
}
@@ -1550,7 +1554,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
SetSourcePosition(prop->position());
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::KeyedLoadIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
}
@@ -1889,7 +1893,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
__ mov(edx, eax);
__ pop(eax); // Restore value.
__ mov(ecx, prop->key()->AsLiteral()->handle());
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::StoreIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
break;
@@ -1901,7 +1905,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
__ mov(ecx, eax);
__ pop(edx);
__ pop(eax); // Restore value.
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::KeyedStoreIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
break;
@@ -1924,7 +1928,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
// ecx, and the global object on the stack.
__ mov(ecx, var->name());
__ mov(edx, GlobalObjectOperand());
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::StoreIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
@@ -1939,7 +1943,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
if (op == Token::INIT_CONST) {
// Detect const reinitialization by checking for the hole value.
__ mov(edx, Operand(ebp, SlotOffset(slot)));
- __ cmp(edx, FACTORY->the_hole_value());
+ __ cmp(edx, isolate()->factory()->the_hole_value());
__ j(not_equal, &done);
}
// Perform the assignment.
@@ -1951,7 +1955,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
if (op == Token::INIT_CONST) {
// Detect const reinitialization by checking for the hole value.
__ mov(edx, target);
- __ cmp(edx, FACTORY->the_hole_value());
+ __ cmp(edx, isolate()->factory()->the_hole_value());
__ j(not_equal, &done);
}
// Perform the assignment and issue the write barrier.
@@ -2009,7 +2013,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
} else {
__ pop(edx);
}
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::StoreIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
@@ -2048,7 +2052,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
}
// Record source code position before IC call.
SetSourcePosition(expr->position());
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::KeyedStoreIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
@@ -2098,8 +2102,8 @@ void FullCodeGenerator::EmitCallWithIC(Call* expr,
// Record source position of the IC call.
SetSourcePosition(expr->position());
InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
- Handle<Code> ic = ISOLATE->stub_cache()->ComputeCallInitialize(arg_count,
- in_loop);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(
+ arg_count, in_loop);
EmitCallIC(ic, mode);
RecordJSReturnSite(expr);
// Restore context register.
@@ -2131,8 +2135,8 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
// Record source position of the IC call.
SetSourcePosition(expr->position());
InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
- Handle<Code> ic = ISOLATE->stub_cache()->ComputeKeyedCallInitialize(arg_count,
- in_loop);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize(
+ arg_count, in_loop);
__ mov(ecx, Operand(esp, (arg_count + 1) * kPointerSize)); // Key.
EmitCallIC(ic, mode);
RecordJSReturnSite(expr);
@@ -2184,7 +2188,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
{ PreservePositionScope pos_scope(masm()->positions_recorder());
VisitForStackValue(fun);
// Reserved receiver slot.
- __ push(Immediate(FACTORY->undefined_value()));
+ __ push(Immediate(isolate()->factory()->undefined_value()));
// Push the arguments.
for (int i = 0; i < arg_count; i++) {
@@ -2198,7 +2202,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
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 and do runtime call.
@@ -2285,7 +2289,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
SetSourcePosition(prop->position());
__ pop(edx); // We do not need to keep the receiver.
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::KeyedLoadIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
// Push result (function).
@@ -2304,7 +2308,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
// also use the full code generator.
FunctionLiteral* lit = fun->AsFunctionLiteral();
if (lit != NULL &&
- lit->name()->Equals(HEAP->empty_string()) &&
+ lit->name()->Equals(isolate()->heap()->empty_string()) &&
loop_depth() == 0) {
lit->set_try_full_codegen(true);
}
@@ -2351,7 +2355,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) {
__ Set(eax, Immediate(arg_count));
__ mov(edi, Operand(esp, arg_count * kPointerSize));
- Handle<Code> construct_builtin(Isolate::Current()->builtins()->builtin(
+ Handle<Code> construct_builtin(isolate()->builtins()->builtin(
Builtins::JSConstructCall));
__ call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
context()->Plug(eax);
@@ -2412,7 +2416,7 @@ void FullCodeGenerator::EmitIsObject(ZoneList<Expression*>* args) {
__ test(eax, Immediate(kSmiTagMask));
__ j(zero, if_false);
- __ cmp(eax, FACTORY->null_value());
+ __ cmp(eax, isolate()->factory()->null_value());
__ j(equal, if_true);
__ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
// Undetectable objects behave like undefined when tested with typeof.
@@ -2691,17 +2695,17 @@ void FullCodeGenerator::EmitClassOf(ZoneList<Expression*>* args) {
// Functions have class 'Function'.
__ bind(&function);
- __ mov(eax, FACTORY->function_class_symbol());
+ __ mov(eax, isolate()->factory()->function_class_symbol());
__ jmp(&done);
// Objects with a non-function constructor have class 'Object'.
__ bind(&non_function_constructor);
- __ mov(eax, FACTORY->Object_symbol());
+ __ mov(eax, isolate()->factory()->Object_symbol());
__ jmp(&done);
// Non-JS objects have class null.
__ bind(&null);
- __ mov(eax, FACTORY->null_value());
+ __ mov(eax, isolate()->factory()->null_value());
// All done.
__ bind(&done);
@@ -2727,7 +2731,7 @@ void FullCodeGenerator::EmitLog(ZoneList<Expression*>* args) {
}
#endif
// Finally, we're expected to leave a value on the top of the stack.
- __ mov(eax, FACTORY->undefined_value());
+ __ mov(eax, isolate()->factory()->undefined_value());
context()->Plug(eax);
}
@@ -2755,7 +2759,7 @@ void FullCodeGenerator::EmitRandomHeapNumber(ZoneList<Expression*>* args) {
// by computing:
// ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
// This is implemented on both SSE2 and FPU.
- if (Isolate::Current()->cpu_features()->IsSupported(SSE2)) {
+ if (isolate()->cpu_features()->IsSupported(SSE2)) {
CpuFeatures::Scope fscope(SSE2);
__ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single.
__ movd(xmm1, Operand(ebx));
@@ -2924,13 +2928,13 @@ void FullCodeGenerator::EmitStringCharCodeAt(ZoneList<Expression*>* args) {
__ bind(&index_out_of_range);
// When the index is out of range, the spec requires us to return
// NaN.
- __ Set(result, Immediate(FACTORY->nan_value()));
+ __ Set(result, Immediate(isolate()->factory()->nan_value()));
__ jmp(&done);
__ bind(&need_conversion);
// Move the undefined value into the result register, which will
// trigger conversion.
- __ Set(result, Immediate(FACTORY->undefined_value()));
+ __ Set(result, Immediate(isolate()->factory()->undefined_value()));
__ jmp(&done);
NopRuntimeCallHelper call_helper;
@@ -2973,7 +2977,7 @@ void FullCodeGenerator::EmitStringCharAt(ZoneList<Expression*>* args) {
__ bind(&index_out_of_range);
// When the index is out of range, the spec requires us to return
// the empty string.
- __ Set(result, Immediate(FACTORY->empty_string()));
+ __ Set(result, Immediate(isolate()->factory()->empty_string()));
__ jmp(&done);
__ bind(&need_conversion);
@@ -3109,7 +3113,7 @@ void FullCodeGenerator::EmitSwapElements(ZoneList<Expression*>* args) {
// Check the object's elements are in fast case and writable.
__ mov(elements, FieldOperand(object, JSObject::kElementsOffset));
__ cmp(FieldOperand(elements, HeapObject::kMapOffset),
- Immediate(FACTORY->fixed_array_map()));
+ Immediate(isolate()->factory()->fixed_array_map()));
__ j(not_equal, &slow_case);
// Check that both indices are smis.
@@ -3140,7 +3144,7 @@ void FullCodeGenerator::EmitSwapElements(ZoneList<Expression*>* args) {
__ bind(&new_space);
// We are done. Drop elements from the stack, and return undefined.
__ add(Operand(esp), Immediate(3 * kPointerSize));
- __ mov(eax, FACTORY->undefined_value());
+ __ mov(eax, isolate()->factory()->undefined_value());
__ jmp(&done);
__ bind(&slow_case);
@@ -3158,10 +3162,10 @@ void FullCodeGenerator::EmitGetFromCache(ZoneList<Expression*>* args) {
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value();
Handle<FixedArray> jsfunction_result_caches(
- Isolate::Current()->global_context()->jsfunction_result_caches());
+ isolate()->global_context()->jsfunction_result_caches());
if (jsfunction_result_caches->length() <= cache_id) {
__ Abort("Attempt to use undefined cache.");
- __ mov(eax, FACTORY->undefined_value());
+ __ mov(eax, isolate()->factory()->undefined_value());
context()->Plug(eax);
return;
}
@@ -3227,10 +3231,10 @@ void FullCodeGenerator::EmitIsRegExpEquivalent(ZoneList<Expression*>* args) {
__ cmp(tmp, FieldOperand(right, JSRegExp::kDataOffset));
__ j(equal, &ok);
__ bind(&fail);
- __ mov(eax, Immediate(FACTORY->false_value()));
+ __ mov(eax, Immediate(isolate()->factory()->false_value()));
__ jmp(&done);
__ bind(&ok);
- __ mov(eax, Immediate(FACTORY->true_value()));
+ __ mov(eax, Immediate(isolate()->factory()->true_value()));
__ bind(&done);
context()->Plug(eax);
@@ -3327,7 +3331,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(ZoneList<Expression*>* args) {
__ sar(scratch, 1);
Label non_trivial;
__ j(not_zero, &non_trivial);
- __ mov(result, FACTORY->empty_string());
+ __ mov(result, isolate()->factory()->empty_string());
__ jmp(&done);
__ bind(&non_trivial);
@@ -3451,7 +3455,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(ZoneList<Expression*>* args) {
__ jmp(&loop); // End while (index < length).
__ bind(&bailout);
- __ mov(result, FACTORY->undefined_value());
+ __ mov(result, isolate()->factory()->undefined_value());
__ bind(&done);
__ mov(eax, result);
// Drop temp values from the stack, and restore context register.
@@ -3489,8 +3493,8 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
// Call the JS runtime function via a call IC.
__ Set(ecx, Immediate(expr->name()));
InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
- Handle<Code> ic = ISOLATE->stub_cache()->ComputeCallInitialize(arg_count,
- in_loop);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(
+ arg_count, in_loop);
EmitCallIC(ic, RelocInfo::CODE_TARGET);
// Restore context register.
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
@@ -3547,7 +3551,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
case Token::VOID: {
Comment cmnt(masm_, "[ UnaryOperation (VOID)");
VisitForEffect(expr->expression());
- context()->Plug(FACTORY->undefined_value());
+ context()->Plug(isolate()->factory()->undefined_value());
break;
}
@@ -3783,7 +3787,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
case NAMED_PROPERTY: {
__ mov(ecx, prop->key()->AsLiteral()->handle());
__ pop(edx);
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::StoreIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
if (expr->is_postfix()) {
@@ -3798,7 +3802,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
case KEYED_PROPERTY: {
__ pop(ecx);
__ pop(edx);
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::KeyedStoreIC_Initialize));
EmitCallIC(ic, RelocInfo::CODE_TARGET);
if (expr->is_postfix()) {
@@ -3824,7 +3828,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
Comment cmnt(masm_, "Global variable");
__ mov(eax, GlobalObjectOperand());
__ mov(ecx, Immediate(proxy->name()));
- Handle<Code> ic(Isolate::Current()->builtins()->builtin(
+ Handle<Code> ic(isolate()->builtins()->builtin(
Builtins::LoadIC_Initialize));
// Use a regular load, not a contextual load, to avoid a reference
// error.
@@ -3878,13 +3882,13 @@ bool FullCodeGenerator::TryLiteralCompare(Token::Value op,
}
PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
- if (check->Equals(HEAP->number_symbol())) {
+ if (check->Equals(isolate()->heap()->number_symbol())) {
__ test(eax, Immediate(kSmiTagMask));
__ j(zero, if_true);
__ cmp(FieldOperand(eax, HeapObject::kMapOffset),
- FACTORY->heap_number_map());
+ isolate()->factory()->heap_number_map());
Split(equal, if_true, if_false, fall_through);
- } else if (check->Equals(HEAP->string_symbol())) {
+ } else if (check->Equals(isolate()->heap()->string_symbol())) {
__ test(eax, Immediate(kSmiTagMask));
__ j(zero, if_false);
// Check for undetectable objects => false.
@@ -3894,13 +3898,13 @@ bool FullCodeGenerator::TryLiteralCompare(Token::Value op,
__ j(not_zero, if_false);
__ CmpInstanceType(edx, FIRST_NONSTRING_TYPE);
Split(below, if_true, if_false, fall_through);
- } else if (check->Equals(HEAP->boolean_symbol())) {
- __ cmp(eax, FACTORY->true_value());
+ } else if (check->Equals(isolate()->heap()->boolean_symbol())) {
+ __ cmp(eax, isolate()->factory()->true_value());
__ j(equal, if_true);
- __ cmp(eax, FACTORY->false_value());
+ __ cmp(eax, isolate()->factory()->false_value());
Split(equal, if_true, if_false, fall_through);
- } else if (check->Equals(HEAP->undefined_symbol())) {
- __ cmp(eax, FACTORY->undefined_value());
+ } else if (check->Equals(isolate()->heap()->undefined_symbol())) {
+ __ cmp(eax, isolate()->factory()->undefined_value());
__ j(equal, if_true);
__ test(eax, Immediate(kSmiTagMask));
__ j(zero, if_false);
@@ -3909,7 +3913,7 @@ bool FullCodeGenerator::TryLiteralCompare(Token::Value op,
__ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset));
__ test(ecx, Immediate(1 << Map::kIsUndetectable));
Split(not_zero, if_true, if_false, fall_through);
- } else if (check->Equals(HEAP->function_symbol())) {
+ } else if (check->Equals(isolate()->heap()->function_symbol())) {
__ test(eax, Immediate(kSmiTagMask));
__ j(zero, if_false);
__ CmpObjectType(eax, JS_FUNCTION_TYPE, edx);
@@ -3917,10 +3921,10 @@ bool FullCodeGenerator::TryLiteralCompare(Token::Value op,
// Regular expressions => 'function' (they are callable).
__ CmpInstanceType(edx, JS_REGEXP_TYPE);
Split(equal, if_true, if_false, fall_through);
- } else if (check->Equals(HEAP->object_symbol())) {
+ } else if (check->Equals(isolate()->heap()->object_symbol())) {
__ test(eax, Immediate(kSmiTagMask));
__ j(zero, if_false);
- __ cmp(eax, FACTORY->null_value());
+ __ cmp(eax, isolate()->factory()->null_value());
__ j(equal, if_true);
// Regular expressions => 'function', not 'object'.
__ CmpObjectType(eax, JS_REGEXP_TYPE, edx);
@@ -3973,7 +3977,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
VisitForStackValue(expr->right());
__ InvokeBuiltin(Builtins::IN, CALL_FUNCTION);
PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
- __ cmp(eax, FACTORY->true_value());
+ __ cmp(eax, isolate()->factory()->true_value());
Split(equal, if_true, if_false, fall_through);
break;
@@ -4065,12 +4069,12 @@ void FullCodeGenerator::VisitCompareToNull(CompareToNull* expr) {
VisitForAccumulatorValue(expr->expression());
PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
- __ cmp(eax, FACTORY->null_value());
+ __ cmp(eax, isolate()->factory()->null_value());
if (expr->is_strict()) {
Split(equal, if_true, if_false, fall_through);
} else {
__ j(equal, if_true);
- __ cmp(eax, FACTORY->undefined_value());
+ __ cmp(eax, isolate()->factory()->undefined_value());
__ j(equal, if_true);
__ test(eax, Immediate(kSmiTagMask));
__ j(zero, if_false);
@@ -4105,16 +4109,16 @@ void FullCodeGenerator::EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode) {
mode == RelocInfo::CODE_TARGET_CONTEXT);
switch (ic->kind()) {
case Code::LOAD_IC:
- __ IncrementCounter(COUNTERS->named_load_full(), 1);
+ __ IncrementCounter(isolate()->counters()->named_load_full(), 1);
break;
case Code::KEYED_LOAD_IC:
- __ IncrementCounter(COUNTERS->keyed_load_full(), 1);
+ __ IncrementCounter(isolate()->counters()->keyed_load_full(), 1);
break;
case Code::STORE_IC:
- __ IncrementCounter(COUNTERS->named_store_full(), 1);
+ __ IncrementCounter(isolate()->counters()->named_store_full(), 1);
break;
case Code::KEYED_STORE_IC:
- __ IncrementCounter(COUNTERS->keyed_store_full(), 1);
+ __ IncrementCounter(isolate()->counters()->keyed_store_full(), 1);
default:
break;
}
« no previous file with comments | « src/full-codegen.cc ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698