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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4454 | 4454 |
4455 // Load the argument count into r0 and the function into r1 as per | 4455 // Load the argument count into r0 and the function into r1 as per |
4456 // calling convention. | 4456 // calling convention. |
4457 __ mov(r0, Operand(arg_count)); | 4457 __ mov(r0, Operand(arg_count)); |
4458 __ ldr(r1, frame_->ElementAt(arg_count)); | 4458 __ ldr(r1, frame_->ElementAt(arg_count)); |
4459 | 4459 |
4460 // Call the construct call builtin that handles allocation and | 4460 // Call the construct call builtin that handles allocation and |
4461 // constructor invocation. | 4461 // constructor invocation. |
4462 CodeForSourcePosition(node->position()); | 4462 CodeForSourcePosition(node->position()); |
4463 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 4463 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
4464 Builtins::JSConstructCall)); | 4464 Builtins::kJSConstructCall)); |
4465 frame_->CallCodeObject(ic, RelocInfo::CONSTRUCT_CALL, arg_count + 1); | 4465 frame_->CallCodeObject(ic, RelocInfo::CONSTRUCT_CALL, arg_count + 1); |
4466 frame_->EmitPush(r0); | 4466 frame_->EmitPush(r0); |
4467 | 4467 |
4468 ASSERT_EQ(original_height + 1, frame_->height()); | 4468 ASSERT_EQ(original_height + 1, frame_->height()); |
4469 } | 4469 } |
4470 | 4470 |
4471 | 4471 |
4472 void CodeGenerator::GenerateClassOf(ZoneList<Expression*>* args) { | 4472 void CodeGenerator::GenerateClassOf(ZoneList<Expression*>* args) { |
4473 Register scratch = VirtualFrame::scratch0(); | 4473 Register scratch = VirtualFrame::scratch0(); |
4474 JumpTarget null, function, leave, non_function_constructor; | 4474 JumpTarget null, function, leave, non_function_constructor; |
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6594 __ IncrementCounter(masm_->isolate()->counters()->named_load_inline_miss(), | 6594 __ IncrementCounter(masm_->isolate()->counters()->named_load_inline_miss(), |
6595 1, scratch1, scratch2); | 6595 1, scratch1, scratch2); |
6596 | 6596 |
6597 // Ensure receiver in r0 and name in r2 to match load ic calling convention. | 6597 // Ensure receiver in r0 and name in r2 to match load ic calling convention. |
6598 __ Move(r0, receiver_); | 6598 __ Move(r0, receiver_); |
6599 __ mov(r2, Operand(name_)); | 6599 __ mov(r2, Operand(name_)); |
6600 | 6600 |
6601 // The rest of the instructions in the deferred code must be together. | 6601 // The rest of the instructions in the deferred code must be together. |
6602 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 6602 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
6603 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 6603 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
6604 Builtins::LoadIC_Initialize)); | 6604 Builtins::kLoadIC_Initialize)); |
6605 RelocInfo::Mode mode = is_contextual_ | 6605 RelocInfo::Mode mode = is_contextual_ |
6606 ? RelocInfo::CODE_TARGET_CONTEXT | 6606 ? RelocInfo::CODE_TARGET_CONTEXT |
6607 : RelocInfo::CODE_TARGET; | 6607 : RelocInfo::CODE_TARGET; |
6608 __ Call(ic, mode); | 6608 __ Call(ic, mode); |
6609 // We must mark the code just after the call with the correct marker. | 6609 // We must mark the code just after the call with the correct marker. |
6610 MacroAssembler::NopMarkerTypes code_marker; | 6610 MacroAssembler::NopMarkerTypes code_marker; |
6611 if (is_contextual_) { | 6611 if (is_contextual_) { |
6612 code_marker = is_dont_delete_ | 6612 code_marker = is_dont_delete_ |
6613 ? MacroAssembler::PROPERTY_ACCESS_INLINED_CONTEXT_DONT_DELETE | 6613 ? MacroAssembler::PROPERTY_ACCESS_INLINED_CONTEXT_DONT_DELETE |
6614 : MacroAssembler::PROPERTY_ACCESS_INLINED_CONTEXT; | 6614 : MacroAssembler::PROPERTY_ACCESS_INLINED_CONTEXT; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6671 // Ensure key in r0 and receiver in r1 to match keyed load ic calling | 6671 // Ensure key in r0 and receiver in r1 to match keyed load ic calling |
6672 // convention. | 6672 // convention. |
6673 if (key_.is(r1)) { | 6673 if (key_.is(r1)) { |
6674 __ Swap(r0, r1, ip); | 6674 __ Swap(r0, r1, ip); |
6675 } | 6675 } |
6676 | 6676 |
6677 // The rest of the instructions in the deferred code must be together. | 6677 // The rest of the instructions in the deferred code must be together. |
6678 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 6678 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
6679 // Call keyed load IC. It has the arguments key and receiver in r0 and r1. | 6679 // Call keyed load IC. It has the arguments key and receiver in r0 and r1. |
6680 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 6680 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
6681 Builtins::KeyedLoadIC_Initialize)); | 6681 Builtins::kKeyedLoadIC_Initialize)); |
6682 __ Call(ic, RelocInfo::CODE_TARGET); | 6682 __ Call(ic, RelocInfo::CODE_TARGET); |
6683 // The call must be followed by a nop instruction to indicate that the | 6683 // The call must be followed by a nop instruction to indicate that the |
6684 // keyed load has been inlined. | 6684 // keyed load has been inlined. |
6685 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); | 6685 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); |
6686 | 6686 |
6687 // Now go back to the frame that we entered with. This will not overwrite | 6687 // Now go back to the frame that we entered with. This will not overwrite |
6688 // the receiver or key registers since they were not in use when we came | 6688 // the receiver or key registers since they were not in use when we came |
6689 // in. The instructions emitted by this merge are skipped over by the | 6689 // in. The instructions emitted by this merge are skipped over by the |
6690 // inline load patching mechanism when looking for the branch instruction | 6690 // inline load patching mechanism when looking for the branch instruction |
6691 // that tells it where the code to patch is. | 6691 // that tells it where the code to patch is. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6735 if (value_.is(r1)) { | 6735 if (value_.is(r1)) { |
6736 __ Swap(r0, r1, ip); | 6736 __ Swap(r0, r1, ip); |
6737 } | 6737 } |
6738 ASSERT(receiver_.is(r2)); | 6738 ASSERT(receiver_.is(r2)); |
6739 | 6739 |
6740 // The rest of the instructions in the deferred code must be together. | 6740 // The rest of the instructions in the deferred code must be together. |
6741 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 6741 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
6742 // Call keyed store IC. It has the arguments value, key and receiver in r0, | 6742 // Call keyed store IC. It has the arguments value, key and receiver in r0, |
6743 // r1 and r2. | 6743 // r1 and r2. |
6744 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 6744 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
6745 (strict_mode_ == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict | 6745 (strict_mode_ == kStrictMode) |
6746 : Builtins::KeyedStoreIC_Initialize)); | 6746 ? Builtins::kKeyedStoreIC_Initialize_Strict |
| 6747 : Builtins::kKeyedStoreIC_Initialize)); |
6747 __ Call(ic, RelocInfo::CODE_TARGET); | 6748 __ Call(ic, RelocInfo::CODE_TARGET); |
6748 // The call must be followed by a nop instruction to indicate that the | 6749 // The call must be followed by a nop instruction to indicate that the |
6749 // keyed store has been inlined. | 6750 // keyed store has been inlined. |
6750 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); | 6751 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); |
6751 | 6752 |
6752 // Block the constant pool for one more instruction after leaving this | 6753 // Block the constant pool for one more instruction after leaving this |
6753 // constant pool block scope to include the branch instruction ending the | 6754 // constant pool block scope to include the branch instruction ending the |
6754 // deferred code. | 6755 // deferred code. |
6755 __ BlockConstPoolFor(1); | 6756 __ BlockConstPoolFor(1); |
6756 } | 6757 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6790 // Ensure value in r0, receiver in r1 to match store ic calling | 6791 // Ensure value in r0, receiver in r1 to match store ic calling |
6791 // convention. | 6792 // convention. |
6792 ASSERT(value_.is(r0) && receiver_.is(r1)); | 6793 ASSERT(value_.is(r0) && receiver_.is(r1)); |
6793 __ mov(r2, Operand(name_)); | 6794 __ mov(r2, Operand(name_)); |
6794 | 6795 |
6795 // The rest of the instructions in the deferred code must be together. | 6796 // The rest of the instructions in the deferred code must be together. |
6796 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 6797 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
6797 // Call keyed store IC. It has the arguments value, key and receiver in r0, | 6798 // Call keyed store IC. It has the arguments value, key and receiver in r0, |
6798 // r1 and r2. | 6799 // r1 and r2. |
6799 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 6800 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
6800 (strict_mode_ == kStrictMode) ? Builtins::StoreIC_Initialize_Strict | 6801 (strict_mode_ == kStrictMode) ? Builtins::kStoreIC_Initialize_Strict |
6801 : Builtins::StoreIC_Initialize)); | 6802 : Builtins::kStoreIC_Initialize)); |
6802 __ Call(ic, RelocInfo::CODE_TARGET); | 6803 __ Call(ic, RelocInfo::CODE_TARGET); |
6803 // The call must be followed by a nop instruction to indicate that the | 6804 // The call must be followed by a nop instruction to indicate that the |
6804 // named store has been inlined. | 6805 // named store has been inlined. |
6805 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); | 6806 __ MarkCode(MacroAssembler::PROPERTY_ACCESS_INLINED); |
6806 | 6807 |
6807 // Go back to the frame we entered with. The instructions | 6808 // Go back to the frame we entered with. The instructions |
6808 // generated by this merge are skipped over by the inline store | 6809 // generated by this merge are skipped over by the inline store |
6809 // patching mechanism when looking for the branch instruction that | 6810 // patching mechanism when looking for the branch instruction that |
6810 // tells it where the code to patch is. | 6811 // tells it where the code to patch is. |
6811 copied_frame.MergeTo(frame_state()->frame()); | 6812 copied_frame.MergeTo(frame_state()->frame()); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7426 specialized_on_rhs_ ? "_ConstantRhs" : "", | 7427 specialized_on_rhs_ ? "_ConstantRhs" : "", |
7427 BinaryOpIC::GetName(runtime_operands_type_)); | 7428 BinaryOpIC::GetName(runtime_operands_type_)); |
7428 return name_; | 7429 return name_; |
7429 } | 7430 } |
7430 | 7431 |
7431 #undef __ | 7432 #undef __ |
7432 | 7433 |
7433 } } // namespace v8::internal | 7434 } } // namespace v8::internal |
7434 | 7435 |
7435 #endif // V8_TARGET_ARCH_ARM | 7436 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |