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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize; | 261 int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize; |
262 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); | 262 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
263 __ RecordJSReturn(); | 263 __ RecordJSReturn(); |
264 masm_->mov(sp, fp); | 264 masm_->mov(sp, fp); |
265 masm_->ldm(ia_w, sp, fp.bit() | lr.bit()); | 265 masm_->ldm(ia_w, sp, fp.bit() | lr.bit()); |
266 masm_->add(sp, sp, Operand(sp_delta)); | 266 masm_->add(sp, sp, Operand(sp_delta)); |
267 masm_->Jump(lr); | 267 masm_->Jump(lr); |
268 } | 268 } |
269 | 269 |
270 #ifdef DEBUG | 270 #ifdef DEBUG |
271 // Check that the size of the code used for returning matches what is | 271 // Check that the size of the code used for returning is large enough |
272 // expected by the debugger. If the sp_delts above cannot be encoded in the | 272 // for the debugger's requirements. |
273 // add instruction the add will generate two instructions. | 273 ASSERT(Assembler::kJSReturnSequenceInstructions <= |
274 int return_sequence_length = | 274 masm_->InstructionsGeneratedSince(&check_exit_codesize)); |
275 masm_->InstructionsGeneratedSince(&check_exit_codesize); | |
276 CHECK(return_sequence_length == | |
277 Assembler::kJSReturnSequenceInstructions || | |
278 return_sequence_length == | |
279 Assembler::kJSReturnSequenceInstructions + 1); | |
280 #endif | 275 #endif |
281 } | 276 } |
282 } | 277 } |
283 | 278 |
284 | 279 |
285 FullCodeGenerator::ConstantOperand FullCodeGenerator::GetConstantOperand( | 280 FullCodeGenerator::ConstantOperand FullCodeGenerator::GetConstantOperand( |
286 Token::Value op, Expression* left, Expression* right) { | 281 Token::Value op, Expression* left, Expression* right) { |
287 ASSERT(ShouldInlineSmiCase(op)); | 282 ASSERT(ShouldInlineSmiCase(op)); |
288 return kNoConstants; | 283 return kNoConstants; |
289 } | 284 } |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 __ Push(cp, r2, r1, r0); | 669 __ Push(cp, r2, r1, r0); |
675 } | 670 } |
676 __ CallRuntime(Runtime::kDeclareContextSlot, 4); | 671 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
677 break; | 672 break; |
678 } | 673 } |
679 } | 674 } |
680 | 675 |
681 } else if (prop != NULL) { | 676 } else if (prop != NULL) { |
682 if (function != NULL || mode == Variable::CONST) { | 677 if (function != NULL || mode == Variable::CONST) { |
683 // We are declaring a function or constant that rewrites to a | 678 // We are declaring a function or constant that rewrites to a |
684 // property. Use (keyed) IC to set the initial value. | 679 // property. Use (keyed) IC to set the initial value. We |
685 VisitForStackValue(prop->obj()); | 680 // cannot visit the rewrite because it's shared and we risk |
| 681 // recording duplicate AST IDs for bailouts from optimized code. |
| 682 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
| 683 { AccumulatorValueContext for_object(this); |
| 684 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); |
| 685 } |
686 if (function != NULL) { | 686 if (function != NULL) { |
687 VisitForStackValue(prop->key()); | 687 __ push(r0); |
688 VisitForAccumulatorValue(function); | 688 VisitForAccumulatorValue(function); |
689 __ pop(r1); // Key. | 689 __ pop(r2); |
690 } else { | 690 } else { |
691 VisitForAccumulatorValue(prop->key()); | 691 __ mov(r2, r0); |
692 __ mov(r1, result_register()); // Key. | 692 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex); |
693 __ LoadRoot(result_register(), Heap::kTheHoleValueRootIndex); | |
694 } | 693 } |
695 __ pop(r2); // Receiver. | 694 ASSERT(prop->key()->AsLiteral() != NULL && |
| 695 prop->key()->AsLiteral()->handle()->IsSmi()); |
| 696 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); |
696 | 697 |
697 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 698 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); |
698 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 699 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
699 // Value in r0 is ignored (declarations are statements). | 700 // Value in r0 is ignored (declarations are statements). |
700 } | 701 } |
701 } | 702 } |
702 } | 703 } |
703 | 704 |
704 | 705 |
705 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 706 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
(...skipping 2922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3628 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 3629 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
3629 __ add(pc, r1, Operand(masm_->CodeObject())); | 3630 __ add(pc, r1, Operand(masm_->CodeObject())); |
3630 } | 3631 } |
3631 | 3632 |
3632 | 3633 |
3633 #undef __ | 3634 #undef __ |
3634 | 3635 |
3635 } } // namespace v8::internal | 3636 } } // namespace v8::internal |
3636 | 3637 |
3637 #endif // V8_TARGET_ARCH_ARM | 3638 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |