OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 VisitStatements(clause->statements()); | 1028 VisitStatements(clause->statements()); |
1029 } | 1029 } |
1030 | 1030 |
1031 __ bind(nested_statement.break_label()); | 1031 __ bind(nested_statement.break_label()); |
1032 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1032 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1033 } | 1033 } |
1034 | 1034 |
1035 | 1035 |
1036 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 1036 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
1037 Comment cmnt(masm_, "[ ForInStatement"); | 1037 Comment cmnt(masm_, "[ ForInStatement"); |
1038 int slot = stmt->ForInFeedbackSlot(); | 1038 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
1039 | 1039 |
1040 SetStatementPosition(stmt); | 1040 SetStatementPosition(stmt); |
1041 | 1041 |
1042 Label loop, exit; | 1042 Label loop, exit; |
1043 ForIn loop_statement(this, stmt); | 1043 ForIn loop_statement(this, stmt); |
1044 increment_loop_depth(); | 1044 increment_loop_depth(); |
1045 | 1045 |
1046 // Get the object to enumerate over. If the object is null or undefined, skip | 1046 // Get the object to enumerate over. If the object is null or undefined, skip |
1047 // over the loop. See ECMA-262 version 5, section 12.6.4. | 1047 // over the loop. See ECMA-262 version 5, section 12.6.4. |
1048 VisitForAccumulatorValue(stmt->enumerable()); | 1048 VisitForAccumulatorValue(stmt->enumerable()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 __ bind(&no_descriptors); | 1110 __ bind(&no_descriptors); |
1111 __ add(esp, Immediate(kPointerSize)); | 1111 __ add(esp, Immediate(kPointerSize)); |
1112 __ jmp(&exit); | 1112 __ jmp(&exit); |
1113 | 1113 |
1114 // We got a fixed array in register eax. Iterate through that. | 1114 // We got a fixed array in register eax. Iterate through that. |
1115 Label non_proxy; | 1115 Label non_proxy; |
1116 __ bind(&fixed_array); | 1116 __ bind(&fixed_array); |
1117 | 1117 |
1118 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1118 // No need for a write barrier, we are storing a Smi in the feedback vector. |
1119 __ LoadHeapObject(ebx, FeedbackVector()); | 1119 __ LoadHeapObject(ebx, FeedbackVector()); |
1120 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(slot)), | 1120 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(slot.ToInt())), |
1121 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1121 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1122 | 1122 |
1123 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check | 1123 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check |
1124 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object | 1124 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object |
1125 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1125 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
1126 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); | 1126 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); |
1127 __ j(above, &non_proxy); | 1127 __ j(above, &non_proxy); |
1128 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy | 1128 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy |
1129 __ bind(&non_proxy); | 1129 __ bind(&non_proxy); |
1130 __ push(ebx); // Smi | 1130 __ push(ebx); // Smi |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 Comment cnmt(masm_, "[ SuperReference "); | 1282 Comment cnmt(masm_, "[ SuperReference "); |
1283 | 1283 |
1284 __ mov(LoadDescriptor::ReceiverRegister(), | 1284 __ mov(LoadDescriptor::ReceiverRegister(), |
1285 Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1285 Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1286 | 1286 |
1287 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | 1287 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); |
1288 __ mov(LoadDescriptor::NameRegister(), home_object_symbol); | 1288 __ mov(LoadDescriptor::NameRegister(), home_object_symbol); |
1289 | 1289 |
1290 if (FLAG_vector_ics) { | 1290 if (FLAG_vector_ics) { |
1291 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1291 __ mov(VectorLoadICDescriptor::SlotRegister(), |
1292 Immediate(Smi::FromInt(expr->HomeObjectFeedbackSlot()))); | 1292 Immediate(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); |
1293 CallLoadIC(NOT_CONTEXTUAL); | 1293 CallLoadIC(NOT_CONTEXTUAL); |
1294 } else { | 1294 } else { |
1295 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId()); | 1295 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId()); |
1296 } | 1296 } |
1297 | 1297 |
1298 __ cmp(eax, isolate()->factory()->undefined_value()); | 1298 __ cmp(eax, isolate()->factory()->undefined_value()); |
1299 Label done; | 1299 Label done; |
1300 __ j(not_equal, &done); | 1300 __ j(not_equal, &done); |
1301 __ CallRuntime(Runtime::kThrowNonMethodError, 0); | 1301 __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
1302 __ bind(&done); | 1302 __ bind(&done); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 __ jmp(&next); | 1350 __ jmp(&next); |
1351 __ bind(&fast); | 1351 __ bind(&fast); |
1352 } | 1352 } |
1353 | 1353 |
1354 // All extension objects were empty and it is safe to use a global | 1354 // All extension objects were empty and it is safe to use a global |
1355 // load IC call. | 1355 // load IC call. |
1356 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1356 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1357 __ mov(LoadDescriptor::NameRegister(), proxy->var()->name()); | 1357 __ mov(LoadDescriptor::NameRegister(), proxy->var()->name()); |
1358 if (FLAG_vector_ics) { | 1358 if (FLAG_vector_ics) { |
1359 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1359 __ mov(VectorLoadICDescriptor::SlotRegister(), |
1360 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); | 1360 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1361 } | 1361 } |
1362 | 1362 |
1363 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) | 1363 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) |
1364 ? NOT_CONTEXTUAL | 1364 ? NOT_CONTEXTUAL |
1365 : CONTEXTUAL; | 1365 : CONTEXTUAL; |
1366 | 1366 |
1367 CallLoadIC(mode); | 1367 CallLoadIC(mode); |
1368 } | 1368 } |
1369 | 1369 |
1370 | 1370 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 | 1437 |
1438 // Three cases: global variables, lookup variables, and all other types of | 1438 // Three cases: global variables, lookup variables, and all other types of |
1439 // variables. | 1439 // variables. |
1440 switch (var->location()) { | 1440 switch (var->location()) { |
1441 case Variable::UNALLOCATED: { | 1441 case Variable::UNALLOCATED: { |
1442 Comment cmnt(masm_, "[ Global variable"); | 1442 Comment cmnt(masm_, "[ Global variable"); |
1443 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1443 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1444 __ mov(LoadDescriptor::NameRegister(), var->name()); | 1444 __ mov(LoadDescriptor::NameRegister(), var->name()); |
1445 if (FLAG_vector_ics) { | 1445 if (FLAG_vector_ics) { |
1446 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1446 __ mov(VectorLoadICDescriptor::SlotRegister(), |
1447 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); | 1447 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1448 } | 1448 } |
1449 CallLoadIC(CONTEXTUAL); | 1449 CallLoadIC(CONTEXTUAL); |
1450 context()->Plug(eax); | 1450 context()->Plug(eax); |
1451 break; | 1451 break; |
1452 } | 1452 } |
1453 | 1453 |
1454 case Variable::PARAMETER: | 1454 case Variable::PARAMETER: |
1455 case Variable::LOCAL: | 1455 case Variable::LOCAL: |
1456 case Variable::CONTEXT: { | 1456 case Variable::CONTEXT: { |
1457 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" | 1457 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2072 __ mov(load_name, isolate()->factory()->next_string()); | 2072 __ mov(load_name, isolate()->factory()->next_string()); |
2073 __ push(load_name); // "next" | 2073 __ push(load_name); // "next" |
2074 __ push(Operand(esp, 2 * kPointerSize)); // iter | 2074 __ push(Operand(esp, 2 * kPointerSize)); // iter |
2075 __ push(eax); // received | 2075 __ push(eax); // received |
2076 | 2076 |
2077 // result = receiver[f](arg); | 2077 // result = receiver[f](arg); |
2078 __ bind(&l_call); | 2078 __ bind(&l_call); |
2079 __ mov(load_receiver, Operand(esp, kPointerSize)); | 2079 __ mov(load_receiver, Operand(esp, kPointerSize)); |
2080 if (FLAG_vector_ics) { | 2080 if (FLAG_vector_ics) { |
2081 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2081 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2082 Immediate(Smi::FromInt(expr->KeyedLoadFeedbackSlot()))); | 2082 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2083 } | 2083 } |
2084 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2084 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2085 CallIC(ic, TypeFeedbackId::None()); | 2085 CallIC(ic, TypeFeedbackId::None()); |
2086 __ mov(edi, eax); | 2086 __ mov(edi, eax); |
2087 __ mov(Operand(esp, 2 * kPointerSize), edi); | 2087 __ mov(Operand(esp, 2 * kPointerSize), edi); |
2088 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2088 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2089 __ CallStub(&stub); | 2089 __ CallStub(&stub); |
2090 | 2090 |
2091 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2091 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2092 __ Drop(1); // The function is still on the stack; drop it. | 2092 __ Drop(1); // The function is still on the stack; drop it. |
2093 | 2093 |
2094 // if (!result.done) goto l_try; | 2094 // if (!result.done) goto l_try; |
2095 __ bind(&l_loop); | 2095 __ bind(&l_loop); |
2096 __ push(eax); // save result | 2096 __ push(eax); // save result |
2097 __ Move(load_receiver, eax); // result | 2097 __ Move(load_receiver, eax); // result |
2098 __ mov(load_name, | 2098 __ mov(load_name, |
2099 isolate()->factory()->done_string()); // "done" | 2099 isolate()->factory()->done_string()); // "done" |
2100 if (FLAG_vector_ics) { | 2100 if (FLAG_vector_ics) { |
2101 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2101 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2102 Immediate(Smi::FromInt(expr->DoneFeedbackSlot()))); | 2102 Immediate(SmiFromSlot(expr->DoneFeedbackSlot()))); |
2103 } | 2103 } |
2104 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax | 2104 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax |
2105 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2105 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
2106 CallIC(bool_ic); | 2106 CallIC(bool_ic); |
2107 __ test(eax, eax); | 2107 __ test(eax, eax); |
2108 __ j(zero, &l_try); | 2108 __ j(zero, &l_try); |
2109 | 2109 |
2110 // result.value | 2110 // result.value |
2111 __ pop(load_receiver); // result | 2111 __ pop(load_receiver); // result |
2112 __ mov(load_name, | 2112 __ mov(load_name, |
2113 isolate()->factory()->value_string()); // "value" | 2113 isolate()->factory()->value_string()); // "value" |
2114 if (FLAG_vector_ics) { | 2114 if (FLAG_vector_ics) { |
2115 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2115 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2116 Immediate(Smi::FromInt(expr->ValueFeedbackSlot()))); | 2116 Immediate(SmiFromSlot(expr->ValueFeedbackSlot()))); |
2117 } | 2117 } |
2118 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax | 2118 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax |
2119 context()->DropAndPlug(2, eax); // drop iter and g | 2119 context()->DropAndPlug(2, eax); // drop iter and g |
2120 break; | 2120 break; |
2121 } | 2121 } |
2122 } | 2122 } |
2123 } | 2123 } |
2124 | 2124 |
2125 | 2125 |
2126 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2126 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 | 2272 |
2273 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2273 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2274 SetSourcePosition(prop->position()); | 2274 SetSourcePosition(prop->position()); |
2275 Literal* key = prop->key()->AsLiteral(); | 2275 Literal* key = prop->key()->AsLiteral(); |
2276 DCHECK(!key->value()->IsSmi()); | 2276 DCHECK(!key->value()->IsSmi()); |
2277 DCHECK(!prop->IsSuperAccess()); | 2277 DCHECK(!prop->IsSuperAccess()); |
2278 | 2278 |
2279 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); | 2279 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); |
2280 if (FLAG_vector_ics) { | 2280 if (FLAG_vector_ics) { |
2281 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2281 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2282 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); | 2282 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2283 CallLoadIC(NOT_CONTEXTUAL); | 2283 CallLoadIC(NOT_CONTEXTUAL); |
2284 } else { | 2284 } else { |
2285 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 2285 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
2286 } | 2286 } |
2287 } | 2287 } |
2288 | 2288 |
2289 | 2289 |
2290 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2290 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
2291 // Stack: receiver, home_object. | 2291 // Stack: receiver, home_object. |
2292 SetSourcePosition(prop->position()); | 2292 SetSourcePosition(prop->position()); |
2293 Literal* key = prop->key()->AsLiteral(); | 2293 Literal* key = prop->key()->AsLiteral(); |
2294 DCHECK(!key->value()->IsSmi()); | 2294 DCHECK(!key->value()->IsSmi()); |
2295 DCHECK(prop->IsSuperAccess()); | 2295 DCHECK(prop->IsSuperAccess()); |
2296 | 2296 |
2297 __ push(Immediate(key->value())); | 2297 __ push(Immediate(key->value())); |
2298 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2298 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
2299 } | 2299 } |
2300 | 2300 |
2301 | 2301 |
2302 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2302 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2303 SetSourcePosition(prop->position()); | 2303 SetSourcePosition(prop->position()); |
2304 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2304 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2305 if (FLAG_vector_ics) { | 2305 if (FLAG_vector_ics) { |
2306 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2306 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2307 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); | 2307 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2308 CallIC(ic); | 2308 CallIC(ic); |
2309 } else { | 2309 } else { |
2310 CallIC(ic, prop->PropertyFeedbackId()); | 2310 CallIC(ic, prop->PropertyFeedbackId()); |
2311 } | 2311 } |
2312 } | 2312 } |
2313 | 2313 |
2314 | 2314 |
2315 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2315 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2316 // Stack: receiver, home_object, key. | 2316 // Stack: receiver, home_object, key. |
2317 SetSourcePosition(prop->position()); | 2317 SetSourcePosition(prop->position()); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2793 { PreservePositionScope scope(masm()->positions_recorder()); | 2793 { PreservePositionScope scope(masm()->positions_recorder()); |
2794 for (int i = 0; i < arg_count; i++) { | 2794 for (int i = 0; i < arg_count; i++) { |
2795 VisitForStackValue(args->at(i)); | 2795 VisitForStackValue(args->at(i)); |
2796 } | 2796 } |
2797 } | 2797 } |
2798 | 2798 |
2799 // Record source position of the IC call. | 2799 // Record source position of the IC call. |
2800 SetSourcePosition(expr->position()); | 2800 SetSourcePosition(expr->position()); |
2801 Handle<Code> ic = CallIC::initialize_stub( | 2801 Handle<Code> ic = CallIC::initialize_stub( |
2802 isolate(), arg_count, call_type); | 2802 isolate(), arg_count, call_type); |
2803 __ Move(edx, Immediate(Smi::FromInt(expr->CallFeedbackSlot()))); | 2803 __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); |
2804 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2804 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
2805 // Don't assign a type feedback id to the IC, since type feedback is provided | 2805 // Don't assign a type feedback id to the IC, since type feedback is provided |
2806 // by the vector above. | 2806 // by the vector above. |
2807 CallIC(ic); | 2807 CallIC(ic); |
2808 | 2808 |
2809 RecordJSReturnSite(expr); | 2809 RecordJSReturnSite(expr); |
2810 | 2810 |
2811 // Restore context register. | 2811 // Restore context register. |
2812 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2812 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2813 | 2813 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2984 // constructor invocation. | 2984 // constructor invocation. |
2985 SetSourcePosition(expr->position()); | 2985 SetSourcePosition(expr->position()); |
2986 | 2986 |
2987 // Load function and argument count into edi and eax. | 2987 // Load function and argument count into edi and eax. |
2988 __ Move(eax, Immediate(arg_count)); | 2988 __ Move(eax, Immediate(arg_count)); |
2989 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2989 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
2990 | 2990 |
2991 // Record call targets in unoptimized code. | 2991 // Record call targets in unoptimized code. |
2992 if (FLAG_pretenuring_call_new) { | 2992 if (FLAG_pretenuring_call_new) { |
2993 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 2993 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
2994 DCHECK(expr->AllocationSiteFeedbackSlot() == | 2994 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
2995 expr->CallNewFeedbackSlot() + 1); | 2995 expr->CallNewFeedbackSlot().ToInt() + 1); |
2996 } | 2996 } |
2997 | 2997 |
2998 __ LoadHeapObject(ebx, FeedbackVector()); | 2998 __ LoadHeapObject(ebx, FeedbackVector()); |
2999 __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot()))); | 2999 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
3000 | 3000 |
3001 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3001 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
3002 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3002 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3003 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3003 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
3004 context()->Plug(eax); | 3004 context()->Plug(eax); |
3005 } | 3005 } |
3006 | 3006 |
3007 | 3007 |
3008 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3008 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
3009 ZoneList<Expression*>* args = expr->arguments(); | 3009 ZoneList<Expression*>* args = expr->arguments(); |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4241 if (expr->is_jsruntime()) { | 4241 if (expr->is_jsruntime()) { |
4242 // Push the builtins object as receiver. | 4242 // Push the builtins object as receiver. |
4243 __ mov(eax, GlobalObjectOperand()); | 4243 __ mov(eax, GlobalObjectOperand()); |
4244 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); | 4244 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); |
4245 | 4245 |
4246 // Load the function from the receiver. | 4246 // Load the function from the receiver. |
4247 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); | 4247 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); |
4248 __ mov(LoadDescriptor::NameRegister(), Immediate(expr->name())); | 4248 __ mov(LoadDescriptor::NameRegister(), Immediate(expr->name())); |
4249 if (FLAG_vector_ics) { | 4249 if (FLAG_vector_ics) { |
4250 __ mov(VectorLoadICDescriptor::SlotRegister(), | 4250 __ mov(VectorLoadICDescriptor::SlotRegister(), |
4251 Immediate(Smi::FromInt(expr->CallRuntimeFeedbackSlot()))); | 4251 Immediate(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4252 CallLoadIC(NOT_CONTEXTUAL); | 4252 CallLoadIC(NOT_CONTEXTUAL); |
4253 } else { | 4253 } else { |
4254 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 4254 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
4255 } | 4255 } |
4256 | 4256 |
4257 // Push the target function under the receiver. | 4257 // Push the target function under the receiver. |
4258 __ push(Operand(esp, 0)); | 4258 __ push(Operand(esp, 0)); |
4259 __ mov(Operand(esp, kPointerSize), eax); | 4259 __ mov(Operand(esp, kPointerSize), eax); |
4260 | 4260 |
4261 // Code common for calls using the IC. | 4261 // Code common for calls using the IC. |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4653 VariableProxy* proxy = expr->AsVariableProxy(); | 4653 VariableProxy* proxy = expr->AsVariableProxy(); |
4654 DCHECK(!context()->IsEffect()); | 4654 DCHECK(!context()->IsEffect()); |
4655 DCHECK(!context()->IsTest()); | 4655 DCHECK(!context()->IsTest()); |
4656 | 4656 |
4657 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 4657 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
4658 Comment cmnt(masm_, "[ Global variable"); | 4658 Comment cmnt(masm_, "[ Global variable"); |
4659 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 4659 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
4660 __ mov(LoadDescriptor::NameRegister(), Immediate(proxy->name())); | 4660 __ mov(LoadDescriptor::NameRegister(), Immediate(proxy->name())); |
4661 if (FLAG_vector_ics) { | 4661 if (FLAG_vector_ics) { |
4662 __ mov(VectorLoadICDescriptor::SlotRegister(), | 4662 __ mov(VectorLoadICDescriptor::SlotRegister(), |
4663 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); | 4663 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
4664 } | 4664 } |
4665 // Use a regular load, not a contextual load, to avoid a reference | 4665 // Use a regular load, not a contextual load, to avoid a reference |
4666 // error. | 4666 // error. |
4667 CallLoadIC(NOT_CONTEXTUAL); | 4667 CallLoadIC(NOT_CONTEXTUAL); |
4668 PrepareForBailout(expr, TOS_REG); | 4668 PrepareForBailout(expr, TOS_REG); |
4669 context()->Plug(eax); | 4669 context()->Plug(eax); |
4670 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 4670 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
4671 Comment cmnt(masm_, "[ Lookup slot"); | 4671 Comment cmnt(masm_, "[ Lookup slot"); |
4672 Label done, slow; | 4672 Label done, slow; |
4673 | 4673 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5082 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5082 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5083 Assembler::target_address_at(call_target_address, | 5083 Assembler::target_address_at(call_target_address, |
5084 unoptimized_code)); | 5084 unoptimized_code)); |
5085 return OSR_AFTER_STACK_CHECK; | 5085 return OSR_AFTER_STACK_CHECK; |
5086 } | 5086 } |
5087 | 5087 |
5088 | 5088 |
5089 } } // namespace v8::internal | 5089 } } // namespace v8::internal |
5090 | 5090 |
5091 #endif // V8_TARGET_ARCH_IA32 | 5091 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |