| 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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 } else if (prop != NULL) { | 776 } else if (prop != NULL) { |
| 777 // A const declaration aliasing a parameter is an illegal redeclaration. | 777 // A const declaration aliasing a parameter is an illegal redeclaration. |
| 778 ASSERT(mode != Variable::CONST); | 778 ASSERT(mode != Variable::CONST); |
| 779 if (function != NULL) { | 779 if (function != NULL) { |
| 780 // We are declaring a function that rewrites to a property. | 780 // We are declaring a function that rewrites to a property. |
| 781 // Use (keyed) IC to set the initial value. We cannot visit the | 781 // Use (keyed) IC to set the initial value. We cannot visit the |
| 782 // rewrite because it's shared and we risk recording duplicate AST | 782 // rewrite because it's shared and we risk recording duplicate AST |
| 783 // IDs for bailouts from optimized code. | 783 // IDs for bailouts from optimized code. |
| 784 ASSERT(prop->obj()->AsVariableProxy() != NULL); | 784 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
| 785 { AccumulatorValueContext for_object(this); | 785 { AccumulatorValueContext for_object(this); |
| 786 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); | 786 EmitVariableLoad(prop->obj()->AsVariableProxy()); |
| 787 } | 787 } |
| 788 | 788 |
| 789 __ push(result_register()); | 789 __ push(result_register()); |
| 790 VisitForAccumulatorValue(function); | 790 VisitForAccumulatorValue(function); |
| 791 __ mov(a0, result_register()); | 791 __ mov(a0, result_register()); |
| 792 __ pop(a2); | 792 __ pop(a2); |
| 793 | 793 |
| 794 ASSERT(prop->key()->AsLiteral() != NULL && | 794 ASSERT(prop->key()->AsLiteral() != NULL && |
| 795 prop->key()->AsLiteral()->handle()->IsSmi()); | 795 prop->key()->AsLiteral()->handle()->IsSmi()); |
| 796 __ li(a1, Operand(prop->key()->AsLiteral()->handle())); | 796 __ li(a1, Operand(prop->key()->AsLiteral()->handle())); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 : Heap::kFalseValueRootIndex); | 1110 : Heap::kFalseValueRootIndex); |
| 1111 __ Push(cp, a0, a1); | 1111 __ Push(cp, a0, a1); |
| 1112 __ CallRuntime(Runtime::kNewClosure, 3); | 1112 __ CallRuntime(Runtime::kNewClosure, 3); |
| 1113 } | 1113 } |
| 1114 context()->Plug(v0); | 1114 context()->Plug(v0); |
| 1115 } | 1115 } |
| 1116 | 1116 |
| 1117 | 1117 |
| 1118 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { | 1118 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { |
| 1119 Comment cmnt(masm_, "[ VariableProxy"); | 1119 Comment cmnt(masm_, "[ VariableProxy"); |
| 1120 EmitVariableLoad(expr->var()); | 1120 EmitVariableLoad(expr); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 | 1123 |
| 1124 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions( | 1124 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions( |
| 1125 Slot* slot, | 1125 Slot* slot, |
| 1126 TypeofState typeof_state, | 1126 TypeofState typeof_state, |
| 1127 Label* slow) { | 1127 Label* slow) { |
| 1128 Register current = cp; | 1128 Register current = cp; |
| 1129 Register next = a1; | 1129 Register next = a1; |
| 1130 Register temp = a2; | 1130 Register temp = a2; |
| (...skipping 124 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 __ Branch(done); | 1257 __ Branch(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 a2 and the global | 1277 // Use inline caching. Variable name is passed in a2 and the global |
| 1274 // object (receiver) in a0. | 1278 // object (receiver) in a0. |
| 1275 __ lw(a0, GlobalObjectOperand()); | 1279 __ lw(a0, GlobalObjectOperand()); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 } | 1595 } |
| 1592 break; | 1596 break; |
| 1593 } | 1597 } |
| 1594 | 1598 |
| 1595 // For compound assignments we need another deoptimization point after the | 1599 // For compound assignments we need another deoptimization point after the |
| 1596 // variable/property load. | 1600 // variable/property load. |
| 1597 if (expr->is_compound()) { | 1601 if (expr->is_compound()) { |
| 1598 { AccumulatorValueContext context(this); | 1602 { AccumulatorValueContext context(this); |
| 1599 switch (assign_type) { | 1603 switch (assign_type) { |
| 1600 case VARIABLE: | 1604 case VARIABLE: |
| 1601 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); | 1605 EmitVariableLoad(expr->target()->AsVariableProxy()); |
| 1602 PrepareForBailout(expr->target(), TOS_REG); | 1606 PrepareForBailout(expr->target(), TOS_REG); |
| 1603 break; | 1607 break; |
| 1604 case NAMED_PROPERTY: | 1608 case NAMED_PROPERTY: |
| 1605 EmitNamedPropertyLoad(property); | 1609 EmitNamedPropertyLoad(property); |
| 1606 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | 1610 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
| 1607 break; | 1611 break; |
| 1608 case KEYED_PROPERTY: | 1612 case KEYED_PROPERTY: |
| 1609 EmitKeyedPropertyLoad(property); | 1613 EmitKeyedPropertyLoad(property); |
| 1610 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | 1614 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
| 1611 break; | 1615 break; |
| (...skipping 2220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3832 // of the key to detect a named property. | 3836 // of the key to detect a named property. |
| 3833 if (prop != NULL) { | 3837 if (prop != NULL) { |
| 3834 assign_type = | 3838 assign_type = |
| 3835 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; | 3839 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; |
| 3836 } | 3840 } |
| 3837 | 3841 |
| 3838 // Evaluate expression and get value. | 3842 // Evaluate expression and get value. |
| 3839 if (assign_type == VARIABLE) { | 3843 if (assign_type == VARIABLE) { |
| 3840 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); | 3844 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); |
| 3841 AccumulatorValueContext context(this); | 3845 AccumulatorValueContext context(this); |
| 3842 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); | 3846 EmitVariableLoad(expr->expression()->AsVariableProxy()); |
| 3843 } else { | 3847 } else { |
| 3844 // Reserve space for result of postfix operation. | 3848 // Reserve space for result of postfix operation. |
| 3845 if (expr->is_postfix() && !context()->IsEffect()) { | 3849 if (expr->is_postfix() && !context()->IsEffect()) { |
| 3846 __ li(at, Operand(Smi::FromInt(0))); | 3850 __ li(at, Operand(Smi::FromInt(0))); |
| 3847 __ push(at); | 3851 __ push(at); |
| 3848 } | 3852 } |
| 3849 if (assign_type == NAMED_PROPERTY) { | 3853 if (assign_type == NAMED_PROPERTY) { |
| 3850 // Put the object both on the stack and in the accumulator. | 3854 // Put the object both on the stack and in the accumulator. |
| 3851 VisitForAccumulatorValue(prop->obj()); | 3855 VisitForAccumulatorValue(prop->obj()); |
| 3852 __ push(v0); | 3856 __ push(v0); |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4309 __ Addu(at, a1, Operand(masm_->CodeObject())); | 4313 __ Addu(at, a1, Operand(masm_->CodeObject())); |
| 4310 __ Jump(at); | 4314 __ Jump(at); |
| 4311 } | 4315 } |
| 4312 | 4316 |
| 4313 | 4317 |
| 4314 #undef __ | 4318 #undef __ |
| 4315 | 4319 |
| 4316 } } // namespace v8::internal | 4320 } } // namespace v8::internal |
| 4317 | 4321 |
| 4318 #endif // V8_TARGET_ARCH_MIPS | 4322 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |