OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 } else if (prop != NULL) { | 769 } else if (prop != NULL) { |
770 // A const declaration aliasing a parameter is an illegal redeclaration. | 770 // A const declaration aliasing a parameter is an illegal redeclaration. |
771 ASSERT(mode != Variable::CONST); | 771 ASSERT(mode != Variable::CONST); |
772 if (function != NULL) { | 772 if (function != NULL) { |
773 // We are declaring a function that rewrites to a property. | 773 // We are declaring a function that rewrites to a property. |
774 // Use (keyed) IC to set the initial value. We cannot visit the | 774 // Use (keyed) IC to set the initial value. We cannot visit the |
775 // rewrite because it's shared and we risk recording duplicate AST | 775 // rewrite because it's shared and we risk recording duplicate AST |
776 // IDs for bailouts from optimized code. | 776 // IDs for bailouts from optimized code. |
777 ASSERT(prop->obj()->AsVariableProxy() != NULL); | 777 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
778 { AccumulatorValueContext for_object(this); | 778 { AccumulatorValueContext for_object(this); |
779 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); | 779 EmitVariableLoad(prop->obj()->AsVariableProxy()); |
780 } | 780 } |
781 | 781 |
782 __ push(r0); | 782 __ push(r0); |
783 VisitForAccumulatorValue(function); | 783 VisitForAccumulatorValue(function); |
784 __ pop(r2); | 784 __ pop(r2); |
785 | 785 |
786 ASSERT(prop->key()->AsLiteral() != NULL && | 786 ASSERT(prop->key()->AsLiteral() != NULL && |
787 prop->key()->AsLiteral()->handle()->IsSmi()); | 787 prop->key()->AsLiteral()->handle()->IsSmi()); |
788 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); | 788 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); |
789 | 789 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 : Heap::kFalseValueRootIndex); | 1106 : Heap::kFalseValueRootIndex); |
1107 __ Push(cp, r0, r1); | 1107 __ Push(cp, r0, r1); |
1108 __ CallRuntime(Runtime::kNewClosure, 3); | 1108 __ CallRuntime(Runtime::kNewClosure, 3); |
1109 } | 1109 } |
1110 context()->Plug(r0); | 1110 context()->Plug(r0); |
1111 } | 1111 } |
1112 | 1112 |
1113 | 1113 |
1114 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { | 1114 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { |
1115 Comment cmnt(masm_, "[ VariableProxy"); | 1115 Comment cmnt(masm_, "[ VariableProxy"); |
1116 EmitVariableLoad(expr->var()); | 1116 EmitVariableLoad(expr); |
1117 } | 1117 } |
1118 | 1118 |
1119 | 1119 |
1120 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions( | 1120 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions( |
1121 Slot* slot, | 1121 Slot* slot, |
1122 TypeofState typeof_state, | 1122 TypeofState typeof_state, |
1123 Label* slow) { | 1123 Label* slow) { |
1124 Register current = cp; | 1124 Register current = cp; |
1125 Register next = r1; | 1125 Register next = r1; |
1126 Register temp = r2; | 1126 Register temp = r2; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 isolate()->builtins()->KeyedLoadIC_Initialize(); | 1255 isolate()->builtins()->KeyedLoadIC_Initialize(); |
1256 __ Call(ic, RelocInfo::CODE_TARGET, GetPropertyId(property)); | 1256 __ Call(ic, RelocInfo::CODE_TARGET, GetPropertyId(property)); |
1257 __ jmp(done); | 1257 __ jmp(done); |
1258 } | 1258 } |
1259 } | 1259 } |
1260 } | 1260 } |
1261 } | 1261 } |
1262 } | 1262 } |
1263 | 1263 |
1264 | 1264 |
1265 void FullCodeGenerator::EmitVariableLoad(Variable* var) { | 1265 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { |
| 1266 // Record position before possible IC call. |
| 1267 SetSourcePosition(proxy->position()); |
| 1268 Variable* var = proxy->var(); |
| 1269 |
1266 // Three cases: non-this global variables, lookup slots, and all other | 1270 // Three cases: non-this global variables, lookup slots, and all other |
1267 // types of slots. | 1271 // types of slots. |
1268 Slot* slot = var->AsSlot(); | 1272 Slot* slot = var->AsSlot(); |
1269 ASSERT((var->is_global() && !var->is_this()) == (slot == NULL)); | 1273 ASSERT((var->is_global() && !var->is_this()) == (slot == NULL)); |
1270 | 1274 |
1271 if (slot == NULL) { | 1275 if (slot == NULL) { |
1272 Comment cmnt(masm_, "Global variable"); | 1276 Comment cmnt(masm_, "Global variable"); |
1273 // Use inline caching. Variable name is passed in r2 and the global | 1277 // Use inline caching. Variable name is passed in r2 and the global |
1274 // object (receiver) in r0. | 1278 // object (receiver) in r0. |
1275 __ ldr(r0, GlobalObjectOperand()); | 1279 __ ldr(r0, GlobalObjectOperand()); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 } | 1590 } |
1587 break; | 1591 break; |
1588 } | 1592 } |
1589 | 1593 |
1590 // For compound assignments we need another deoptimization point after the | 1594 // For compound assignments we need another deoptimization point after the |
1591 // variable/property load. | 1595 // variable/property load. |
1592 if (expr->is_compound()) { | 1596 if (expr->is_compound()) { |
1593 { AccumulatorValueContext context(this); | 1597 { AccumulatorValueContext context(this); |
1594 switch (assign_type) { | 1598 switch (assign_type) { |
1595 case VARIABLE: | 1599 case VARIABLE: |
1596 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); | 1600 EmitVariableLoad(expr->target()->AsVariableProxy()); |
1597 PrepareForBailout(expr->target(), TOS_REG); | 1601 PrepareForBailout(expr->target(), TOS_REG); |
1598 break; | 1602 break; |
1599 case NAMED_PROPERTY: | 1603 case NAMED_PROPERTY: |
1600 EmitNamedPropertyLoad(property); | 1604 EmitNamedPropertyLoad(property); |
1601 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | 1605 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
1602 break; | 1606 break; |
1603 case KEYED_PROPERTY: | 1607 case KEYED_PROPERTY: |
1604 EmitKeyedPropertyLoad(property); | 1608 EmitKeyedPropertyLoad(property); |
1605 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | 1609 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
1606 break; | 1610 break; |
(...skipping 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3809 // of the key to detect a named property. | 3813 // of the key to detect a named property. |
3810 if (prop != NULL) { | 3814 if (prop != NULL) { |
3811 assign_type = | 3815 assign_type = |
3812 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; | 3816 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; |
3813 } | 3817 } |
3814 | 3818 |
3815 // Evaluate expression and get value. | 3819 // Evaluate expression and get value. |
3816 if (assign_type == VARIABLE) { | 3820 if (assign_type == VARIABLE) { |
3817 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); | 3821 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); |
3818 AccumulatorValueContext context(this); | 3822 AccumulatorValueContext context(this); |
3819 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); | 3823 EmitVariableLoad(expr->expression()->AsVariableProxy()); |
3820 } else { | 3824 } else { |
3821 // Reserve space for result of postfix operation. | 3825 // Reserve space for result of postfix operation. |
3822 if (expr->is_postfix() && !context()->IsEffect()) { | 3826 if (expr->is_postfix() && !context()->IsEffect()) { |
3823 __ mov(ip, Operand(Smi::FromInt(0))); | 3827 __ mov(ip, Operand(Smi::FromInt(0))); |
3824 __ push(ip); | 3828 __ push(ip); |
3825 } | 3829 } |
3826 if (assign_type == NAMED_PROPERTY) { | 3830 if (assign_type == NAMED_PROPERTY) { |
3827 // Put the object both on the stack and in the accumulator. | 3831 // Put the object both on the stack and in the accumulator. |
3828 VisitForAccumulatorValue(prop->obj()); | 3832 VisitForAccumulatorValue(prop->obj()); |
3829 __ push(r0); | 3833 __ push(r0); |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4289 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4293 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4290 __ add(pc, r1, Operand(masm_->CodeObject())); | 4294 __ add(pc, r1, Operand(masm_->CodeObject())); |
4291 } | 4295 } |
4292 | 4296 |
4293 | 4297 |
4294 #undef __ | 4298 #undef __ |
4295 | 4299 |
4296 } } // namespace v8::internal | 4300 } } // namespace v8::internal |
4297 | 4301 |
4298 #endif // V8_TARGET_ARCH_ARM | 4302 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |