OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 STATIC_ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); | 1780 STATIC_ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); |
1781 __ CompareObjectType(receiver_reg, r2, r3, FIRST_JS_OBJECT_TYPE); | 1781 __ CompareObjectType(receiver_reg, r2, r3, FIRST_JS_OBJECT_TYPE); |
1782 __ b(lt, &build_args); | 1782 __ b(lt, &build_args); |
1783 | 1783 |
1784 // Check that applicand.apply is Function.prototype.apply. | 1784 // Check that applicand.apply is Function.prototype.apply. |
1785 __ ldr(r0, MemOperand(sp, kPointerSize)); | 1785 __ ldr(r0, MemOperand(sp, kPointerSize)); |
1786 __ JumpIfSmi(r0, &build_args); | 1786 __ JumpIfSmi(r0, &build_args); |
1787 __ CompareObjectType(r0, r1, r2, JS_FUNCTION_TYPE); | 1787 __ CompareObjectType(r0, r1, r2, JS_FUNCTION_TYPE); |
1788 __ b(ne, &build_args); | 1788 __ b(ne, &build_args); |
1789 Handle<Code> apply_code( | 1789 Handle<Code> apply_code( |
1790 Isolate::Current()->builtins()->builtin(Builtins::FunctionApply)); | 1790 Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply)); |
1791 __ ldr(r1, FieldMemOperand(r0, JSFunction::kCodeEntryOffset)); | 1791 __ ldr(r1, FieldMemOperand(r0, JSFunction::kCodeEntryOffset)); |
1792 __ sub(r1, r1, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1792 __ sub(r1, r1, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1793 __ cmp(r1, Operand(apply_code)); | 1793 __ cmp(r1, Operand(apply_code)); |
1794 __ b(ne, &build_args); | 1794 __ b(ne, &build_args); |
1795 | 1795 |
1796 // Check that applicand is a function. | 1796 // Check that applicand is a function. |
1797 __ ldr(r1, MemOperand(sp, 2 * kPointerSize)); | 1797 __ ldr(r1, MemOperand(sp, 2 * kPointerSize)); |
1798 __ JumpIfSmi(r1, &build_args); | 1798 __ JumpIfSmi(r1, &build_args); |
1799 __ CompareObjectType(r1, r2, r3, JS_FUNCTION_TYPE); | 1799 __ CompareObjectType(r1, r2, r3, JS_FUNCTION_TYPE); |
1800 __ b(ne, &build_args); | 1800 __ b(ne, &build_args); |
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3625 Expression* value = property->value(); | 3625 Expression* value = property->value(); |
3626 switch (property->kind()) { | 3626 switch (property->kind()) { |
3627 case ObjectLiteral::Property::CONSTANT: | 3627 case ObjectLiteral::Property::CONSTANT: |
3628 break; | 3628 break; |
3629 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 3629 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
3630 if (CompileTimeValue::IsCompileTimeValue(property->value())) break; | 3630 if (CompileTimeValue::IsCompileTimeValue(property->value())) break; |
3631 // else fall through | 3631 // else fall through |
3632 case ObjectLiteral::Property::COMPUTED: | 3632 case ObjectLiteral::Property::COMPUTED: |
3633 if (key->handle()->IsSymbol()) { | 3633 if (key->handle()->IsSymbol()) { |
3634 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 3634 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
3635 Builtins::StoreIC_Initialize)); | 3635 Builtins::kStoreIC_Initialize)); |
3636 Load(value); | 3636 Load(value); |
3637 if (property->emit_store()) { | 3637 if (property->emit_store()) { |
3638 frame_->PopToR0(); | 3638 frame_->PopToR0(); |
3639 // Fetch the object literal. | 3639 // Fetch the object literal. |
3640 frame_->SpillAllButCopyTOSToR1(); | 3640 frame_->SpillAllButCopyTOSToR1(); |
3641 __ mov(r2, Operand(key->handle())); | 3641 __ mov(r2, Operand(key->handle())); |
3642 frame_->CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); | 3642 frame_->CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); |
3643 } else { | 3643 } else { |
3644 frame_->Drop(); | 3644 frame_->Drop(); |
3645 } | 3645 } |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4453 | 4453 |
4454 // Load the argument count into r0 and the function into r1 as per | 4454 // Load the argument count into r0 and the function into r1 as per |
4455 // calling convention. | 4455 // calling convention. |
4456 __ mov(r0, Operand(arg_count)); | 4456 __ mov(r0, Operand(arg_count)); |
4457 __ ldr(r1, frame_->ElementAt(arg_count)); | 4457 __ ldr(r1, frame_->ElementAt(arg_count)); |
4458 | 4458 |
4459 // Call the construct call builtin that handles allocation and | 4459 // Call the construct call builtin that handles allocation and |
4460 // constructor invocation. | 4460 // constructor invocation. |
4461 CodeForSourcePosition(node->position()); | 4461 CodeForSourcePosition(node->position()); |
4462 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 4462 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
4463 Builtins::JSConstructCall)); | 4463 Builtins::kJSConstructCall)); |
4464 frame_->CallCodeObject(ic, RelocInfo::CONSTRUCT_CALL, arg_count + 1); | 4464 frame_->CallCodeObject(ic, RelocInfo::CONSTRUCT_CALL, arg_count + 1); |
4465 frame_->EmitPush(r0); | 4465 frame_->EmitPush(r0); |
4466 | 4466 |
4467 ASSERT_EQ(original_height + 1, frame_->height()); | 4467 ASSERT_EQ(original_height + 1, frame_->height()); |
4468 } | 4468 } |
4469 | 4469 |
4470 | 4470 |
4471 void CodeGenerator::GenerateClassOf(ZoneList<Expression*>* args) { | 4471 void CodeGenerator::GenerateClassOf(ZoneList<Expression*>* args) { |
4472 Register scratch = VirtualFrame::scratch0(); | 4472 Register scratch = VirtualFrame::scratch0(); |
4473 JumpTarget null, function, leave, non_function_constructor; | 4473 JumpTarget null, function, leave, non_function_constructor; |
(...skipping 2118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6592 __ IncrementCounter(COUNTERS->named_load_inline_miss(), 1, | 6592 __ IncrementCounter(COUNTERS->named_load_inline_miss(), 1, |
6593 scratch1, scratch2); | 6593 scratch1, scratch2); |
6594 | 6594 |
6595 // Ensure receiver in r0 and name in r2 to match load ic calling convention. | 6595 // Ensure receiver in r0 and name in r2 to match load ic calling convention. |
6596 __ Move(r0, receiver_); | 6596 __ Move(r0, receiver_); |
6597 __ mov(r2, Operand(name_)); | 6597 __ mov(r2, Operand(name_)); |
6598 | 6598 |
6599 // The rest of the instructions in the deferred code must be together. | 6599 // The rest of the instructions in the deferred code must be together. |
6600 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 6600 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
6601 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 6601 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
6602 Builtins::LoadIC_Initialize)); | 6602 Builtins::kLoadIC_Initialize)); |
6603 RelocInfo::Mode mode = is_contextual_ | 6603 RelocInfo::Mode mode = is_contextual_ |
6604 ? RelocInfo::CODE_TARGET_CONTEXT | 6604 ? RelocInfo::CODE_TARGET_CONTEXT |
6605 : RelocInfo::CODE_TARGET; | 6605 : RelocInfo::CODE_TARGET; |
6606 __ Call(ic, mode); | 6606 __ Call(ic, mode); |
6607 // We must mark the code just after the call with the correct marker. | 6607 // We must mark the code just after the call with the correct marker. |
6608 MacroAssembler::NopMarkerTypes code_marker; | 6608 MacroAssembler::NopMarkerTypes code_marker; |
6609 if (is_contextual_) { | 6609 if (is_contextual_) { |
6610 code_marker = is_dont_delete_ | 6610 code_marker = is_dont_delete_ |
6611 ? MacroAssembler::PROPERTY_ACCESS_INLINED_CONTEXT_DONT_DELETE | 6611 ? MacroAssembler::PROPERTY_ACCESS_INLINED_CONTEXT_DONT_DELETE |
6612 : MacroAssembler::PROPERTY_ACCESS_INLINED_CONTEXT; | 6612 : MacroAssembler::PROPERTY_ACCESS_INLINED_CONTEXT; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6668 // Ensure key in r0 and receiver in r1 to match keyed load ic calling | 6668 // Ensure key in r0 and receiver in r1 to match keyed load ic calling |
6669 // convention. | 6669 // convention. |
6670 if (key_.is(r1)) { | 6670 if (key_.is(r1)) { |
6671 __ Swap(r0, r1, ip); | 6671 __ Swap(r0, r1, ip); |
6672 } | 6672 } |
6673 | 6673 |
6674 // The rest of the instructions in the deferred code must be together. | 6674 // The rest of the instructions in the deferred code must be together. |
6675 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 6675 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
6676 // Call keyed load IC. It has the arguments key and receiver in r0 and r1. | 6676 // Call keyed load IC. It has the arguments key and receiver in r0 and r1. |
6677 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 6677 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
6678 Builtins::KeyedLoadIC_Initialize)); | 6678 Builtins::kKeyedLoadIC_Initialize)); |
6679 __ Call(ic, RelocInfo::CODE_TARGET); | 6679 __ Call(ic, RelocInfo::CODE_TARGET); |
6680 // The call must be followed by a nop instruction to indicate that the | 6680 // The call must be followed by a nop instruction to indicate that the |
6681 // keyed load has been inlined. | 6681 // keyed load has been inlined. |
6682 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); | 6682 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); |
6683 | 6683 |
6684 // Now go back to the frame that we entered with. This will not overwrite | 6684 // Now go back to the frame that we entered with. This will not overwrite |
6685 // the receiver or key registers since they were not in use when we came | 6685 // the receiver or key registers since they were not in use when we came |
6686 // in. The instructions emitted by this merge are skipped over by the | 6686 // in. The instructions emitted by this merge are skipped over by the |
6687 // inline load patching mechanism when looking for the branch instruction | 6687 // inline load patching mechanism when looking for the branch instruction |
6688 // that tells it where the code to patch is. | 6688 // that tells it where the code to patch is. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6731 if (value_.is(r1)) { | 6731 if (value_.is(r1)) { |
6732 __ Swap(r0, r1, ip); | 6732 __ Swap(r0, r1, ip); |
6733 } | 6733 } |
6734 ASSERT(receiver_.is(r2)); | 6734 ASSERT(receiver_.is(r2)); |
6735 | 6735 |
6736 // The rest of the instructions in the deferred code must be together. | 6736 // The rest of the instructions in the deferred code must be together. |
6737 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 6737 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
6738 // Call keyed store IC. It has the arguments value, key and receiver in r0, | 6738 // Call keyed store IC. It has the arguments value, key and receiver in r0, |
6739 // r1 and r2. | 6739 // r1 and r2. |
6740 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 6740 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
6741 (strict_mode_ == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict | 6741 (strict_mode_ == kStrictMode) |
6742 : Builtins::KeyedStoreIC_Initialize)); | 6742 ? Builtins::kKeyedStoreIC_Initialize_Strict |
| 6743 : Builtins::kKeyedStoreIC_Initialize)); |
6743 __ Call(ic, RelocInfo::CODE_TARGET); | 6744 __ Call(ic, RelocInfo::CODE_TARGET); |
6744 // The call must be followed by a nop instruction to indicate that the | 6745 // The call must be followed by a nop instruction to indicate that the |
6745 // keyed store has been inlined. | 6746 // keyed store has been inlined. |
6746 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); | 6747 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); |
6747 | 6748 |
6748 // Block the constant pool for one more instruction after leaving this | 6749 // Block the constant pool for one more instruction after leaving this |
6749 // constant pool block scope to include the branch instruction ending the | 6750 // constant pool block scope to include the branch instruction ending the |
6750 // deferred code. | 6751 // deferred code. |
6751 __ BlockConstPoolFor(1); | 6752 __ BlockConstPoolFor(1); |
6752 } | 6753 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6786 // Ensure value in r0, receiver in r1 to match store ic calling | 6787 // Ensure value in r0, receiver in r1 to match store ic calling |
6787 // convention. | 6788 // convention. |
6788 ASSERT(value_.is(r0) && receiver_.is(r1)); | 6789 ASSERT(value_.is(r0) && receiver_.is(r1)); |
6789 __ mov(r2, Operand(name_)); | 6790 __ mov(r2, Operand(name_)); |
6790 | 6791 |
6791 // The rest of the instructions in the deferred code must be together. | 6792 // The rest of the instructions in the deferred code must be together. |
6792 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 6793 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
6793 // Call keyed store IC. It has the arguments value, key and receiver in r0, | 6794 // Call keyed store IC. It has the arguments value, key and receiver in r0, |
6794 // r1 and r2. | 6795 // r1 and r2. |
6795 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 6796 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
6796 (strict_mode_ == kStrictMode) ? Builtins::StoreIC_Initialize_Strict | 6797 (strict_mode_ == kStrictMode) ? Builtins::kStoreIC_Initialize_Strict |
6797 : Builtins::StoreIC_Initialize)); | 6798 : Builtins::kStoreIC_Initialize)); |
6798 __ Call(ic, RelocInfo::CODE_TARGET); | 6799 __ Call(ic, RelocInfo::CODE_TARGET); |
6799 // The call must be followed by a nop instruction to indicate that the | 6800 // The call must be followed by a nop instruction to indicate that the |
6800 // named store has been inlined. | 6801 // named store has been inlined. |
6801 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); | 6802 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); |
6802 | 6803 |
6803 // Go back to the frame we entered with. The instructions | 6804 // Go back to the frame we entered with. The instructions |
6804 // generated by this merge are skipped over by the inline store | 6805 // generated by this merge are skipped over by the inline store |
6805 // patching mechanism when looking for the branch instruction that | 6806 // patching mechanism when looking for the branch instruction that |
6806 // tells it where the code to patch is. | 6807 // tells it where the code to patch is. |
6807 copied_frame.MergeTo(frame_state()->frame()); | 6808 copied_frame.MergeTo(frame_state()->frame()); |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7420 specialized_on_rhs_ ? "_ConstantRhs" : "", | 7421 specialized_on_rhs_ ? "_ConstantRhs" : "", |
7421 BinaryOpIC::GetName(runtime_operands_type_)); | 7422 BinaryOpIC::GetName(runtime_operands_type_)); |
7422 return name_; | 7423 return name_; |
7423 } | 7424 } |
7424 | 7425 |
7425 #undef __ | 7426 #undef __ |
7426 | 7427 |
7427 } } // namespace v8::internal | 7428 } } // namespace v8::internal |
7428 | 7429 |
7429 #endif // V8_TARGET_ARCH_ARM | 7430 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |