| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 if (result_saved) { | 1829 if (result_saved) { |
| 1830 __ addq(rsp, Immediate(kPointerSize)); // literal index | 1830 __ addq(rsp, Immediate(kPointerSize)); // literal index |
| 1831 context()->PlugTOS(); | 1831 context()->PlugTOS(); |
| 1832 } else { | 1832 } else { |
| 1833 context()->Plug(rax); | 1833 context()->Plug(rax); |
| 1834 } | 1834 } |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 | 1837 |
| 1838 void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 1838 void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
| 1839 ASSERT(expr->target()->IsValidLeftHandSide()); |
| 1840 |
| 1839 Comment cmnt(masm_, "[ Assignment"); | 1841 Comment cmnt(masm_, "[ Assignment"); |
| 1840 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | |
| 1841 // on the left-hand side. | |
| 1842 if (!expr->target()->IsValidLeftHandSide()) { | |
| 1843 VisitForEffect(expr->target()); | |
| 1844 return; | |
| 1845 } | |
| 1846 | 1842 |
| 1847 // Left-hand side can only be a property, a global or a (parameter or local) | 1843 // Left-hand side can only be a property, a global or a (parameter or local) |
| 1848 // slot. | 1844 // slot. |
| 1849 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 1845 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
| 1850 LhsKind assign_type = VARIABLE; | 1846 LhsKind assign_type = VARIABLE; |
| 1851 Property* property = expr->target()->AsProperty(); | 1847 Property* property = expr->target()->AsProperty(); |
| 1852 if (property != NULL) { | 1848 if (property != NULL) { |
| 1853 assign_type = (property->key()->IsPropertyName()) | 1849 assign_type = (property->key()->IsPropertyName()) |
| 1854 ? NAMED_PROPERTY | 1850 ? NAMED_PROPERTY |
| 1855 : KEYED_PROPERTY; | 1851 : KEYED_PROPERTY; |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2332 __ pop(rdx); | 2328 __ pop(rdx); |
| 2333 BinaryOpICStub stub(op, mode); | 2329 BinaryOpICStub stub(op, mode); |
| 2334 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2330 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2335 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); | 2331 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); |
| 2336 patch_site.EmitPatchInfo(); | 2332 patch_site.EmitPatchInfo(); |
| 2337 context()->Plug(rax); | 2333 context()->Plug(rax); |
| 2338 } | 2334 } |
| 2339 | 2335 |
| 2340 | 2336 |
| 2341 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2337 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
| 2342 // Invalid left-hand sides are rewritten by the parser to have a 'throw | 2338 ASSERT(expr->IsValidLeftHandSide()); |
| 2343 // ReferenceError' on the left-hand side. | |
| 2344 if (!expr->IsValidLeftHandSide()) { | |
| 2345 VisitForEffect(expr); | |
| 2346 return; | |
| 2347 } | |
| 2348 | 2339 |
| 2349 // Left-hand side can only be a property, a global or a (parameter or local) | 2340 // Left-hand side can only be a property, a global or a (parameter or local) |
| 2350 // slot. | 2341 // slot. |
| 2351 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 2342 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
| 2352 LhsKind assign_type = VARIABLE; | 2343 LhsKind assign_type = VARIABLE; |
| 2353 Property* prop = expr->AsProperty(); | 2344 Property* prop = expr->AsProperty(); |
| 2354 if (prop != NULL) { | 2345 if (prop != NULL) { |
| 2355 assign_type = (prop->key()->IsPropertyName()) | 2346 assign_type = (prop->key()->IsPropertyName()) |
| 2356 ? NAMED_PROPERTY | 2347 ? NAMED_PROPERTY |
| 2357 : KEYED_PROPERTY; | 2348 : KEYED_PROPERTY; |
| (...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4263 break; | 4254 break; |
| 4264 } | 4255 } |
| 4265 | 4256 |
| 4266 default: | 4257 default: |
| 4267 UNREACHABLE(); | 4258 UNREACHABLE(); |
| 4268 } | 4259 } |
| 4269 } | 4260 } |
| 4270 | 4261 |
| 4271 | 4262 |
| 4272 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 4263 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
| 4264 ASSERT(expr->expression()->IsValidLeftHandSide()); |
| 4265 |
| 4273 Comment cmnt(masm_, "[ CountOperation"); | 4266 Comment cmnt(masm_, "[ CountOperation"); |
| 4274 SetSourcePosition(expr->position()); | 4267 SetSourcePosition(expr->position()); |
| 4275 | 4268 |
| 4276 // Invalid left-hand-sides are rewritten to have a 'throw | |
| 4277 // ReferenceError' as the left-hand side. | |
| 4278 if (!expr->expression()->IsValidLeftHandSide()) { | |
| 4279 VisitForEffect(expr->expression()); | |
| 4280 return; | |
| 4281 } | |
| 4282 | |
| 4283 // Expression can only be a property, a global or a (parameter or local) | 4269 // Expression can only be a property, a global or a (parameter or local) |
| 4284 // slot. | 4270 // slot. |
| 4285 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 4271 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
| 4286 LhsKind assign_type = VARIABLE; | 4272 LhsKind assign_type = VARIABLE; |
| 4287 Property* prop = expr->expression()->AsProperty(); | 4273 Property* prop = expr->expression()->AsProperty(); |
| 4288 // In case of a property we use the uninitialized expression context | 4274 // In case of a property we use the uninitialized expression context |
| 4289 // of the key to detect a named property. | 4275 // of the key to detect a named property. |
| 4290 if (prop != NULL) { | 4276 if (prop != NULL) { |
| 4291 assign_type = | 4277 assign_type = |
| 4292 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; | 4278 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4894 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4880 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4895 Assembler::target_address_at(call_target_address, | 4881 Assembler::target_address_at(call_target_address, |
| 4896 unoptimized_code)); | 4882 unoptimized_code)); |
| 4897 return OSR_AFTER_STACK_CHECK; | 4883 return OSR_AFTER_STACK_CHECK; |
| 4898 } | 4884 } |
| 4899 | 4885 |
| 4900 | 4886 |
| 4901 } } // namespace v8::internal | 4887 } } // namespace v8::internal |
| 4902 | 4888 |
| 4903 #endif // V8_TARGET_ARCH_X64 | 4889 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |