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 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 if (result_saved) { | 1852 if (result_saved) { |
1853 __ pop(); // literal index | 1853 __ pop(); // literal index |
1854 context()->PlugTOS(); | 1854 context()->PlugTOS(); |
1855 } else { | 1855 } else { |
1856 context()->Plug(r0); | 1856 context()->Plug(r0); |
1857 } | 1857 } |
1858 } | 1858 } |
1859 | 1859 |
1860 | 1860 |
1861 void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 1861 void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
| 1862 ASSERT(expr->target()->IsValidLeftHandSide()); |
| 1863 |
1862 Comment cmnt(masm_, "[ Assignment"); | 1864 Comment cmnt(masm_, "[ Assignment"); |
1863 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | |
1864 // on the left-hand side. | |
1865 if (!expr->target()->IsValidLeftHandSide()) { | |
1866 VisitForEffect(expr->target()); | |
1867 return; | |
1868 } | |
1869 | 1865 |
1870 // Left-hand side can only be a property, a global or a (parameter or local) | 1866 // Left-hand side can only be a property, a global or a (parameter or local) |
1871 // slot. | 1867 // slot. |
1872 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 1868 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
1873 LhsKind assign_type = VARIABLE; | 1869 LhsKind assign_type = VARIABLE; |
1874 Property* property = expr->target()->AsProperty(); | 1870 Property* property = expr->target()->AsProperty(); |
1875 if (property != NULL) { | 1871 if (property != NULL) { |
1876 assign_type = (property->key()->IsPropertyName()) | 1872 assign_type = (property->key()->IsPropertyName()) |
1877 ? NAMED_PROPERTY | 1873 ? NAMED_PROPERTY |
1878 : KEYED_PROPERTY; | 1874 : KEYED_PROPERTY; |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2389 __ pop(r1); | 2385 __ pop(r1); |
2390 BinaryOpICStub stub(op, mode); | 2386 BinaryOpICStub stub(op, mode); |
2391 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2387 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2392 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); | 2388 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); |
2393 patch_site.EmitPatchInfo(); | 2389 patch_site.EmitPatchInfo(); |
2394 context()->Plug(r0); | 2390 context()->Plug(r0); |
2395 } | 2391 } |
2396 | 2392 |
2397 | 2393 |
2398 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2394 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
2399 // Invalid left-hand sides are rewritten by the parser to have a 'throw | 2395 ASSERT(expr->IsValidLeftHandSide()); |
2400 // ReferenceError' on the left-hand side. | |
2401 if (!expr->IsValidLeftHandSide()) { | |
2402 VisitForEffect(expr); | |
2403 return; | |
2404 } | |
2405 | 2396 |
2406 // Left-hand side can only be a property, a global or a (parameter or local) | 2397 // Left-hand side can only be a property, a global or a (parameter or local) |
2407 // slot. | 2398 // slot. |
2408 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 2399 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
2409 LhsKind assign_type = VARIABLE; | 2400 LhsKind assign_type = VARIABLE; |
2410 Property* prop = expr->AsProperty(); | 2401 Property* prop = expr->AsProperty(); |
2411 if (prop != NULL) { | 2402 if (prop != NULL) { |
2412 assign_type = (prop->key()->IsPropertyName()) | 2403 assign_type = (prop->key()->IsPropertyName()) |
2413 ? NAMED_PROPERTY | 2404 ? NAMED_PROPERTY |
2414 : KEYED_PROPERTY; | 2405 : KEYED_PROPERTY; |
(...skipping 1848 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 ReferenceError' | |
4277 // 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4900 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4886 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
4901 reinterpret_cast<uint32_t>( | 4887 reinterpret_cast<uint32_t>( |
4902 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4888 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4903 return OSR_AFTER_STACK_CHECK; | 4889 return OSR_AFTER_STACK_CHECK; |
4904 } | 4890 } |
4905 | 4891 |
4906 | 4892 |
4907 } } // namespace v8::internal | 4893 } } // namespace v8::internal |
4908 | 4894 |
4909 #endif // V8_TARGET_ARCH_ARM | 4895 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |