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 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 if (result_saved) { | 1873 if (result_saved) { |
1874 __ Pop(); // literal index | 1874 __ Pop(); // literal index |
1875 context()->PlugTOS(); | 1875 context()->PlugTOS(); |
1876 } else { | 1876 } else { |
1877 context()->Plug(v0); | 1877 context()->Plug(v0); |
1878 } | 1878 } |
1879 } | 1879 } |
1880 | 1880 |
1881 | 1881 |
1882 void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 1882 void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
| 1883 ASSERT(expr->target()->IsValidLeftHandSide()); |
| 1884 |
1883 Comment cmnt(masm_, "[ Assignment"); | 1885 Comment cmnt(masm_, "[ Assignment"); |
1884 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | |
1885 // on the left-hand side. | |
1886 if (!expr->target()->IsValidLeftHandSide()) { | |
1887 VisitForEffect(expr->target()); | |
1888 return; | |
1889 } | |
1890 | 1886 |
1891 // Left-hand side can only be a property, a global or a (parameter or local) | 1887 // Left-hand side can only be a property, a global or a (parameter or local) |
1892 // slot. | 1888 // slot. |
1893 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 1889 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
1894 LhsKind assign_type = VARIABLE; | 1890 LhsKind assign_type = VARIABLE; |
1895 Property* property = expr->target()->AsProperty(); | 1891 Property* property = expr->target()->AsProperty(); |
1896 if (property != NULL) { | 1892 if (property != NULL) { |
1897 assign_type = (property->key()->IsPropertyName()) | 1893 assign_type = (property->key()->IsPropertyName()) |
1898 ? NAMED_PROPERTY | 1894 ? NAMED_PROPERTY |
1899 : KEYED_PROPERTY; | 1895 : KEYED_PROPERTY; |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2417 __ pop(a1); | 2413 __ pop(a1); |
2418 BinaryOpICStub stub(op, mode); | 2414 BinaryOpICStub stub(op, mode); |
2419 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2415 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2420 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); | 2416 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); |
2421 patch_site.EmitPatchInfo(); | 2417 patch_site.EmitPatchInfo(); |
2422 context()->Plug(v0); | 2418 context()->Plug(v0); |
2423 } | 2419 } |
2424 | 2420 |
2425 | 2421 |
2426 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2422 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
2427 // Invalid left-hand sides are rewritten by the parser to have a 'throw | 2423 ASSERT(expr->IsValidLeftHandSide()); |
2428 // ReferenceError' on the left-hand side. | |
2429 if (!expr->IsValidLeftHandSide()) { | |
2430 VisitForEffect(expr); | |
2431 return; | |
2432 } | |
2433 | 2424 |
2434 // Left-hand side can only be a property, a global or a (parameter or local) | 2425 // Left-hand side can only be a property, a global or a (parameter or local) |
2435 // slot. | 2426 // slot. |
2436 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 2427 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
2437 LhsKind assign_type = VARIABLE; | 2428 LhsKind assign_type = VARIABLE; |
2438 Property* prop = expr->AsProperty(); | 2429 Property* prop = expr->AsProperty(); |
2439 if (prop != NULL) { | 2430 if (prop != NULL) { |
2440 assign_type = (prop->key()->IsPropertyName()) | 2431 assign_type = (prop->key()->IsPropertyName()) |
2441 ? NAMED_PROPERTY | 2432 ? NAMED_PROPERTY |
2442 : KEYED_PROPERTY; | 2433 : KEYED_PROPERTY; |
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4331 break; | 4322 break; |
4332 } | 4323 } |
4333 | 4324 |
4334 default: | 4325 default: |
4335 UNREACHABLE(); | 4326 UNREACHABLE(); |
4336 } | 4327 } |
4337 } | 4328 } |
4338 | 4329 |
4339 | 4330 |
4340 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 4331 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
| 4332 ASSERT(expr->expression()->IsValidLeftHandSide()); |
| 4333 |
4341 Comment cmnt(masm_, "[ CountOperation"); | 4334 Comment cmnt(masm_, "[ CountOperation"); |
4342 SetSourcePosition(expr->position()); | 4335 SetSourcePosition(expr->position()); |
4343 | 4336 |
4344 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | |
4345 // as the left-hand side. | |
4346 if (!expr->expression()->IsValidLeftHandSide()) { | |
4347 VisitForEffect(expr->expression()); | |
4348 return; | |
4349 } | |
4350 | |
4351 // Expression can only be a property, a global or a (parameter or local) | 4337 // Expression can only be a property, a global or a (parameter or local) |
4352 // slot. | 4338 // slot. |
4353 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 4339 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
4354 LhsKind assign_type = VARIABLE; | 4340 LhsKind assign_type = VARIABLE; |
4355 Property* prop = expr->expression()->AsProperty(); | 4341 Property* prop = expr->expression()->AsProperty(); |
4356 // In case of a property we use the uninitialized expression context | 4342 // In case of a property we use the uninitialized expression context |
4357 // of the key to detect a named property. | 4343 // of the key to detect a named property. |
4358 if (prop != NULL) { | 4344 if (prop != NULL) { |
4359 assign_type = | 4345 assign_type = |
4360 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; | 4346 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4962 Assembler::target_address_at(pc_immediate_load_address)) == | 4948 Assembler::target_address_at(pc_immediate_load_address)) == |
4963 reinterpret_cast<uint32_t>( | 4949 reinterpret_cast<uint32_t>( |
4964 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4950 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4965 return OSR_AFTER_STACK_CHECK; | 4951 return OSR_AFTER_STACK_CHECK; |
4966 } | 4952 } |
4967 | 4953 |
4968 | 4954 |
4969 } } // namespace v8::internal | 4955 } } // namespace v8::internal |
4970 | 4956 |
4971 #endif // V8_TARGET_ARCH_MIPS | 4957 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |