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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 VisitStatements(clause->statements()); | 1017 VisitStatements(clause->statements()); |
1018 } | 1018 } |
1019 | 1019 |
1020 __ bind(nested_statement.break_label()); | 1020 __ bind(nested_statement.break_label()); |
1021 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1021 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1022 } | 1022 } |
1023 | 1023 |
1024 | 1024 |
1025 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 1025 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
1026 Comment cmnt(masm_, "[ ForInStatement"); | 1026 Comment cmnt(masm_, "[ ForInStatement"); |
1027 int slot = stmt->ForInFeedbackSlot(); | 1027 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
1028 | 1028 |
1029 SetStatementPosition(stmt); | 1029 SetStatementPosition(stmt); |
1030 | 1030 |
1031 Label loop, exit; | 1031 Label loop, exit; |
1032 ForIn loop_statement(this, stmt); | 1032 ForIn loop_statement(this, stmt); |
1033 increment_loop_depth(); | 1033 increment_loop_depth(); |
1034 | 1034 |
1035 // Get the object to enumerate over. If the object is null or undefined, skip | 1035 // Get the object to enumerate over. If the object is null or undefined, skip |
1036 // over the loop. See ECMA-262 version 5, section 12.6.4. | 1036 // over the loop. See ECMA-262 version 5, section 12.6.4. |
1037 VisitForAccumulatorValue(stmt->enumerable()); | 1037 VisitForAccumulatorValue(stmt->enumerable()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 __ bind(&no_descriptors); | 1099 __ bind(&no_descriptors); |
1100 __ add(esp, Immediate(kPointerSize)); | 1100 __ add(esp, Immediate(kPointerSize)); |
1101 __ jmp(&exit); | 1101 __ jmp(&exit); |
1102 | 1102 |
1103 // We got a fixed array in register eax. Iterate through that. | 1103 // We got a fixed array in register eax. Iterate through that. |
1104 Label non_proxy; | 1104 Label non_proxy; |
1105 __ bind(&fixed_array); | 1105 __ bind(&fixed_array); |
1106 | 1106 |
1107 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1107 // No need for a write barrier, we are storing a Smi in the feedback vector. |
1108 __ LoadHeapObject(ebx, FeedbackVector()); | 1108 __ LoadHeapObject(ebx, FeedbackVector()); |
1109 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(slot)), | 1109 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(slot.ToInt())), |
1110 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1110 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1111 | 1111 |
1112 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check | 1112 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check |
1113 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object | 1113 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object |
1114 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1114 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
1115 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); | 1115 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); |
1116 __ j(above, &non_proxy); | 1116 __ j(above, &non_proxy); |
1117 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy | 1117 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy |
1118 __ bind(&non_proxy); | 1118 __ bind(&non_proxy); |
1119 __ push(ebx); // Smi | 1119 __ push(ebx); // Smi |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 Comment cnmt(masm_, "[ SuperReference "); | 1271 Comment cnmt(masm_, "[ SuperReference "); |
1272 | 1272 |
1273 __ mov(LoadDescriptor::ReceiverRegister(), | 1273 __ mov(LoadDescriptor::ReceiverRegister(), |
1274 Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1274 Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1275 | 1275 |
1276 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | 1276 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); |
1277 __ mov(LoadDescriptor::NameRegister(), home_object_symbol); | 1277 __ mov(LoadDescriptor::NameRegister(), home_object_symbol); |
1278 | 1278 |
1279 if (FLAG_vector_ics) { | 1279 if (FLAG_vector_ics) { |
1280 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1280 __ mov(VectorLoadICDescriptor::SlotRegister(), |
1281 Immediate(Smi::FromInt(expr->HomeObjectFeedbackSlot()))); | 1281 Immediate(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); |
1282 CallLoadIC(NOT_CONTEXTUAL); | 1282 CallLoadIC(NOT_CONTEXTUAL); |
1283 } else { | 1283 } else { |
1284 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId()); | 1284 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId()); |
1285 } | 1285 } |
1286 | 1286 |
1287 __ cmp(eax, isolate()->factory()->undefined_value()); | 1287 __ cmp(eax, isolate()->factory()->undefined_value()); |
1288 Label done; | 1288 Label done; |
1289 __ j(not_equal, &done); | 1289 __ j(not_equal, &done); |
1290 __ CallRuntime(Runtime::kThrowNonMethodError, 0); | 1290 __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
1291 __ bind(&done); | 1291 __ bind(&done); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 __ jmp(&next); | 1339 __ jmp(&next); |
1340 __ bind(&fast); | 1340 __ bind(&fast); |
1341 } | 1341 } |
1342 | 1342 |
1343 // All extension objects were empty and it is safe to use a global | 1343 // All extension objects were empty and it is safe to use a global |
1344 // load IC call. | 1344 // load IC call. |
1345 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1345 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1346 __ mov(LoadDescriptor::NameRegister(), proxy->var()->name()); | 1346 __ mov(LoadDescriptor::NameRegister(), proxy->var()->name()); |
1347 if (FLAG_vector_ics) { | 1347 if (FLAG_vector_ics) { |
1348 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1348 __ mov(VectorLoadICDescriptor::SlotRegister(), |
1349 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); | 1349 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1350 } | 1350 } |
1351 | 1351 |
1352 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) | 1352 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) |
1353 ? NOT_CONTEXTUAL | 1353 ? NOT_CONTEXTUAL |
1354 : CONTEXTUAL; | 1354 : CONTEXTUAL; |
1355 | 1355 |
1356 CallLoadIC(mode); | 1356 CallLoadIC(mode); |
1357 } | 1357 } |
1358 | 1358 |
1359 | 1359 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 | 1426 |
1427 // Three cases: global variables, lookup variables, and all other types of | 1427 // Three cases: global variables, lookup variables, and all other types of |
1428 // variables. | 1428 // variables. |
1429 switch (var->location()) { | 1429 switch (var->location()) { |
1430 case Variable::UNALLOCATED: { | 1430 case Variable::UNALLOCATED: { |
1431 Comment cmnt(masm_, "[ Global variable"); | 1431 Comment cmnt(masm_, "[ Global variable"); |
1432 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1432 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1433 __ mov(LoadDescriptor::NameRegister(), var->name()); | 1433 __ mov(LoadDescriptor::NameRegister(), var->name()); |
1434 if (FLAG_vector_ics) { | 1434 if (FLAG_vector_ics) { |
1435 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1435 __ mov(VectorLoadICDescriptor::SlotRegister(), |
1436 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); | 1436 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1437 } | 1437 } |
1438 CallLoadIC(CONTEXTUAL); | 1438 CallLoadIC(CONTEXTUAL); |
1439 context()->Plug(eax); | 1439 context()->Plug(eax); |
1440 break; | 1440 break; |
1441 } | 1441 } |
1442 | 1442 |
1443 case Variable::PARAMETER: | 1443 case Variable::PARAMETER: |
1444 case Variable::LOCAL: | 1444 case Variable::LOCAL: |
1445 case Variable::CONTEXT: { | 1445 case Variable::CONTEXT: { |
1446 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" | 1446 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2059 __ mov(load_name, isolate()->factory()->next_string()); | 2059 __ mov(load_name, isolate()->factory()->next_string()); |
2060 __ push(load_name); // "next" | 2060 __ push(load_name); // "next" |
2061 __ push(Operand(esp, 2 * kPointerSize)); // iter | 2061 __ push(Operand(esp, 2 * kPointerSize)); // iter |
2062 __ push(eax); // received | 2062 __ push(eax); // received |
2063 | 2063 |
2064 // result = receiver[f](arg); | 2064 // result = receiver[f](arg); |
2065 __ bind(&l_call); | 2065 __ bind(&l_call); |
2066 __ mov(load_receiver, Operand(esp, kPointerSize)); | 2066 __ mov(load_receiver, Operand(esp, kPointerSize)); |
2067 if (FLAG_vector_ics) { | 2067 if (FLAG_vector_ics) { |
2068 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2068 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2069 Immediate(Smi::FromInt(expr->KeyedLoadFeedbackSlot()))); | 2069 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2070 } | 2070 } |
2071 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2071 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2072 CallIC(ic, TypeFeedbackId::None()); | 2072 CallIC(ic, TypeFeedbackId::None()); |
2073 __ mov(edi, eax); | 2073 __ mov(edi, eax); |
2074 __ mov(Operand(esp, 2 * kPointerSize), edi); | 2074 __ mov(Operand(esp, 2 * kPointerSize), edi); |
2075 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2075 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2076 __ CallStub(&stub); | 2076 __ CallStub(&stub); |
2077 | 2077 |
2078 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2078 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2079 __ Drop(1); // The function is still on the stack; drop it. | 2079 __ Drop(1); // The function is still on the stack; drop it. |
2080 | 2080 |
2081 // if (!result.done) goto l_try; | 2081 // if (!result.done) goto l_try; |
2082 __ bind(&l_loop); | 2082 __ bind(&l_loop); |
2083 __ push(eax); // save result | 2083 __ push(eax); // save result |
2084 __ Move(load_receiver, eax); // result | 2084 __ Move(load_receiver, eax); // result |
2085 __ mov(load_name, | 2085 __ mov(load_name, |
2086 isolate()->factory()->done_string()); // "done" | 2086 isolate()->factory()->done_string()); // "done" |
2087 if (FLAG_vector_ics) { | 2087 if (FLAG_vector_ics) { |
2088 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2088 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2089 Immediate(Smi::FromInt(expr->DoneFeedbackSlot()))); | 2089 Immediate(SmiFromSlot(expr->DoneFeedbackSlot()))); |
2090 } | 2090 } |
2091 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax | 2091 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax |
2092 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2092 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
2093 CallIC(bool_ic); | 2093 CallIC(bool_ic); |
2094 __ test(eax, eax); | 2094 __ test(eax, eax); |
2095 __ j(zero, &l_try); | 2095 __ j(zero, &l_try); |
2096 | 2096 |
2097 // result.value | 2097 // result.value |
2098 __ pop(load_receiver); // result | 2098 __ pop(load_receiver); // result |
2099 __ mov(load_name, | 2099 __ mov(load_name, |
2100 isolate()->factory()->value_string()); // "value" | 2100 isolate()->factory()->value_string()); // "value" |
2101 if (FLAG_vector_ics) { | 2101 if (FLAG_vector_ics) { |
2102 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2102 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2103 Immediate(Smi::FromInt(expr->ValueFeedbackSlot()))); | 2103 Immediate(SmiFromSlot(expr->ValueFeedbackSlot()))); |
2104 } | 2104 } |
2105 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax | 2105 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax |
2106 context()->DropAndPlug(2, eax); // drop iter and g | 2106 context()->DropAndPlug(2, eax); // drop iter and g |
2107 break; | 2107 break; |
2108 } | 2108 } |
2109 } | 2109 } |
2110 } | 2110 } |
2111 | 2111 |
2112 | 2112 |
2113 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2113 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2259 | 2259 |
2260 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2260 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2261 SetSourcePosition(prop->position()); | 2261 SetSourcePosition(prop->position()); |
2262 Literal* key = prop->key()->AsLiteral(); | 2262 Literal* key = prop->key()->AsLiteral(); |
2263 DCHECK(!key->value()->IsSmi()); | 2263 DCHECK(!key->value()->IsSmi()); |
2264 DCHECK(!prop->IsSuperAccess()); | 2264 DCHECK(!prop->IsSuperAccess()); |
2265 | 2265 |
2266 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); | 2266 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); |
2267 if (FLAG_vector_ics) { | 2267 if (FLAG_vector_ics) { |
2268 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2268 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2269 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); | 2269 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2270 CallLoadIC(NOT_CONTEXTUAL); | 2270 CallLoadIC(NOT_CONTEXTUAL); |
2271 } else { | 2271 } else { |
2272 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 2272 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
2273 } | 2273 } |
2274 } | 2274 } |
2275 | 2275 |
2276 | 2276 |
2277 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2277 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
2278 // Stack: receiver, home_object. | 2278 // Stack: receiver, home_object. |
2279 SetSourcePosition(prop->position()); | 2279 SetSourcePosition(prop->position()); |
2280 Literal* key = prop->key()->AsLiteral(); | 2280 Literal* key = prop->key()->AsLiteral(); |
2281 DCHECK(!key->value()->IsSmi()); | 2281 DCHECK(!key->value()->IsSmi()); |
2282 DCHECK(prop->IsSuperAccess()); | 2282 DCHECK(prop->IsSuperAccess()); |
2283 | 2283 |
2284 __ push(Immediate(key->value())); | 2284 __ push(Immediate(key->value())); |
2285 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2285 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
2286 } | 2286 } |
2287 | 2287 |
2288 | 2288 |
2289 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2289 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2290 SetSourcePosition(prop->position()); | 2290 SetSourcePosition(prop->position()); |
2291 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2291 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2292 if (FLAG_vector_ics) { | 2292 if (FLAG_vector_ics) { |
2293 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2293 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2294 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); | 2294 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2295 CallIC(ic); | 2295 CallIC(ic); |
2296 } else { | 2296 } else { |
2297 CallIC(ic, prop->PropertyFeedbackId()); | 2297 CallIC(ic, prop->PropertyFeedbackId()); |
2298 } | 2298 } |
2299 } | 2299 } |
2300 | 2300 |
2301 | 2301 |
2302 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2302 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2303 // Stack: receiver, home_object, key. | 2303 // Stack: receiver, home_object, key. |
2304 SetSourcePosition(prop->position()); | 2304 SetSourcePosition(prop->position()); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2780 { PreservePositionScope scope(masm()->positions_recorder()); | 2780 { PreservePositionScope scope(masm()->positions_recorder()); |
2781 for (int i = 0; i < arg_count; i++) { | 2781 for (int i = 0; i < arg_count; i++) { |
2782 VisitForStackValue(args->at(i)); | 2782 VisitForStackValue(args->at(i)); |
2783 } | 2783 } |
2784 } | 2784 } |
2785 | 2785 |
2786 // Record source position of the IC call. | 2786 // Record source position of the IC call. |
2787 SetSourcePosition(expr->position()); | 2787 SetSourcePosition(expr->position()); |
2788 Handle<Code> ic = CallIC::initialize_stub( | 2788 Handle<Code> ic = CallIC::initialize_stub( |
2789 isolate(), arg_count, call_type); | 2789 isolate(), arg_count, call_type); |
2790 __ Move(edx, Immediate(Smi::FromInt(expr->CallFeedbackSlot()))); | 2790 __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); |
2791 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2791 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
2792 // Don't assign a type feedback id to the IC, since type feedback is provided | 2792 // Don't assign a type feedback id to the IC, since type feedback is provided |
2793 // by the vector above. | 2793 // by the vector above. |
2794 CallIC(ic); | 2794 CallIC(ic); |
2795 | 2795 |
2796 RecordJSReturnSite(expr); | 2796 RecordJSReturnSite(expr); |
2797 | 2797 |
2798 // Restore context register. | 2798 // Restore context register. |
2799 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2799 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2800 | 2800 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2971 // constructor invocation. | 2971 // constructor invocation. |
2972 SetSourcePosition(expr->position()); | 2972 SetSourcePosition(expr->position()); |
2973 | 2973 |
2974 // Load function and argument count into edi and eax. | 2974 // Load function and argument count into edi and eax. |
2975 __ Move(eax, Immediate(arg_count)); | 2975 __ Move(eax, Immediate(arg_count)); |
2976 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2976 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
2977 | 2977 |
2978 // Record call targets in unoptimized code. | 2978 // Record call targets in unoptimized code. |
2979 if (FLAG_pretenuring_call_new) { | 2979 if (FLAG_pretenuring_call_new) { |
2980 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 2980 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
2981 DCHECK(expr->AllocationSiteFeedbackSlot() == | 2981 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
2982 expr->CallNewFeedbackSlot() + 1); | 2982 expr->CallNewFeedbackSlot().ToInt() + 1); |
2983 } | 2983 } |
2984 | 2984 |
2985 __ LoadHeapObject(ebx, FeedbackVector()); | 2985 __ LoadHeapObject(ebx, FeedbackVector()); |
2986 __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot()))); | 2986 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
2987 | 2987 |
2988 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 2988 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
2989 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 2989 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
2990 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2990 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2991 context()->Plug(eax); | 2991 context()->Plug(eax); |
2992 } | 2992 } |
2993 | 2993 |
2994 | 2994 |
2995 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 2995 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
2996 ZoneList<Expression*>* args = expr->arguments(); | 2996 ZoneList<Expression*>* args = expr->arguments(); |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4227 if (expr->is_jsruntime()) { | 4227 if (expr->is_jsruntime()) { |
4228 // Push the builtins object as receiver. | 4228 // Push the builtins object as receiver. |
4229 __ mov(eax, GlobalObjectOperand()); | 4229 __ mov(eax, GlobalObjectOperand()); |
4230 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); | 4230 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); |
4231 | 4231 |
4232 // Load the function from the receiver. | 4232 // Load the function from the receiver. |
4233 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); | 4233 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); |
4234 __ mov(LoadDescriptor::NameRegister(), Immediate(expr->name())); | 4234 __ mov(LoadDescriptor::NameRegister(), Immediate(expr->name())); |
4235 if (FLAG_vector_ics) { | 4235 if (FLAG_vector_ics) { |
4236 __ mov(VectorLoadICDescriptor::SlotRegister(), | 4236 __ mov(VectorLoadICDescriptor::SlotRegister(), |
4237 Immediate(Smi::FromInt(expr->CallRuntimeFeedbackSlot()))); | 4237 Immediate(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4238 CallLoadIC(NOT_CONTEXTUAL); | 4238 CallLoadIC(NOT_CONTEXTUAL); |
4239 } else { | 4239 } else { |
4240 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 4240 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
4241 } | 4241 } |
4242 | 4242 |
4243 // Push the target function under the receiver. | 4243 // Push the target function under the receiver. |
4244 __ push(Operand(esp, 0)); | 4244 __ push(Operand(esp, 0)); |
4245 __ mov(Operand(esp, kPointerSize), eax); | 4245 __ mov(Operand(esp, kPointerSize), eax); |
4246 | 4246 |
4247 // Code common for calls using the IC. | 4247 // Code common for calls using the IC. |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4639 VariableProxy* proxy = expr->AsVariableProxy(); | 4639 VariableProxy* proxy = expr->AsVariableProxy(); |
4640 DCHECK(!context()->IsEffect()); | 4640 DCHECK(!context()->IsEffect()); |
4641 DCHECK(!context()->IsTest()); | 4641 DCHECK(!context()->IsTest()); |
4642 | 4642 |
4643 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 4643 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
4644 Comment cmnt(masm_, "[ Global variable"); | 4644 Comment cmnt(masm_, "[ Global variable"); |
4645 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 4645 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
4646 __ mov(LoadDescriptor::NameRegister(), Immediate(proxy->name())); | 4646 __ mov(LoadDescriptor::NameRegister(), Immediate(proxy->name())); |
4647 if (FLAG_vector_ics) { | 4647 if (FLAG_vector_ics) { |
4648 __ mov(VectorLoadICDescriptor::SlotRegister(), | 4648 __ mov(VectorLoadICDescriptor::SlotRegister(), |
4649 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); | 4649 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
4650 } | 4650 } |
4651 // Use a regular load, not a contextual load, to avoid a reference | 4651 // Use a regular load, not a contextual load, to avoid a reference |
4652 // error. | 4652 // error. |
4653 CallLoadIC(NOT_CONTEXTUAL); | 4653 CallLoadIC(NOT_CONTEXTUAL); |
4654 PrepareForBailout(expr, TOS_REG); | 4654 PrepareForBailout(expr, TOS_REG); |
4655 context()->Plug(eax); | 4655 context()->Plug(eax); |
4656 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 4656 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
4657 Comment cmnt(masm_, "[ Lookup slot"); | 4657 Comment cmnt(masm_, "[ Lookup slot"); |
4658 Label done, slow; | 4658 Label done, slow; |
4659 | 4659 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5068 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5068 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5069 Assembler::target_address_at(call_target_address, | 5069 Assembler::target_address_at(call_target_address, |
5070 unoptimized_code)); | 5070 unoptimized_code)); |
5071 return OSR_AFTER_STACK_CHECK; | 5071 return OSR_AFTER_STACK_CHECK; |
5072 } | 5072 } |
5073 | 5073 |
5074 | 5074 |
5075 } } // namespace v8::internal | 5075 } } // namespace v8::internal |
5076 | 5076 |
5077 #endif // V8_TARGET_ARCH_X87 | 5077 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |