| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2038 // ----------- S t a t e ------------- | 2038 // ----------- S t a t e ------------- |
| 2039 // -- rax : receiver | 2039 // -- rax : receiver |
| 2040 // -- rcx : name | 2040 // -- rcx : name |
| 2041 // -- rsp[0] : return address | 2041 // -- rsp[0] : return address |
| 2042 // ----------------------------------- | 2042 // ----------------------------------- |
| 2043 receiver = rax; | 2043 receiver = rax; |
| 2044 } | 2044 } |
| 2045 | 2045 |
| 2046 StubCompiler::GenerateLoadFunctionPrototype(masm, receiver, r8, r9, &miss); | 2046 StubCompiler::GenerateLoadFunctionPrototype(masm, receiver, r8, r9, &miss); |
| 2047 __ bind(&miss); | 2047 __ bind(&miss); |
| 2048 StubCompiler::TailCallBuiltin(masm, StubCompiler::MissBuiltin(kind())); | 2048 StubCompiler::TailCallBuiltin( |
| 2049 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind())); |
| 2049 } | 2050 } |
| 2050 | 2051 |
| 2051 | 2052 |
| 2052 void StringLengthStub::Generate(MacroAssembler* masm) { | 2053 void StringLengthStub::Generate(MacroAssembler* masm) { |
| 2053 Label miss; | 2054 Label miss; |
| 2054 Register receiver; | 2055 Register receiver; |
| 2055 if (kind() == Code::KEYED_LOAD_IC) { | 2056 if (kind() == Code::KEYED_LOAD_IC) { |
| 2056 // ----------- S t a t e ------------- | 2057 // ----------- S t a t e ------------- |
| 2057 // -- rax : key | 2058 // -- rax : key |
| 2058 // -- rdx : receiver | 2059 // -- rdx : receiver |
| 2059 // -- rsp[0] : return address | 2060 // -- rsp[0] : return address |
| 2060 // ----------------------------------- | 2061 // ----------------------------------- |
| 2061 __ Cmp(rax, masm->isolate()->factory()->length_string()); | 2062 __ Cmp(rax, masm->isolate()->factory()->length_string()); |
| 2062 __ j(not_equal, &miss); | 2063 __ j(not_equal, &miss); |
| 2063 receiver = rdx; | 2064 receiver = rdx; |
| 2064 } else { | 2065 } else { |
| 2065 ASSERT(kind() == Code::LOAD_IC); | 2066 ASSERT(kind() == Code::LOAD_IC); |
| 2066 // ----------- S t a t e ------------- | 2067 // ----------- S t a t e ------------- |
| 2067 // -- rax : receiver | 2068 // -- rax : receiver |
| 2068 // -- rcx : name | 2069 // -- rcx : name |
| 2069 // -- rsp[0] : return address | 2070 // -- rsp[0] : return address |
| 2070 // ----------------------------------- | 2071 // ----------------------------------- |
| 2071 receiver = rax; | 2072 receiver = rax; |
| 2072 } | 2073 } |
| 2073 | 2074 |
| 2074 StubCompiler::GenerateLoadStringLength(masm, receiver, r8, r9, &miss, | 2075 StubCompiler::GenerateLoadStringLength(masm, receiver, r8, r9, &miss, |
| 2075 support_wrapper_); | 2076 support_wrapper_); |
| 2076 __ bind(&miss); | 2077 __ bind(&miss); |
| 2077 StubCompiler::TailCallBuiltin(masm, StubCompiler::MissBuiltin(kind())); | 2078 StubCompiler::TailCallBuiltin( |
| 2079 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind())); |
| 2078 } | 2080 } |
| 2079 | 2081 |
| 2080 | 2082 |
| 2081 void StoreArrayLengthStub::Generate(MacroAssembler* masm) { | 2083 void StoreArrayLengthStub::Generate(MacroAssembler* masm) { |
| 2082 // ----------- S t a t e ------------- | 2084 // ----------- S t a t e ------------- |
| 2083 // -- rax : value | 2085 // -- rax : value |
| 2084 // -- rcx : key | 2086 // -- rcx : key |
| 2085 // -- rdx : receiver | 2087 // -- rdx : receiver |
| 2086 // -- rsp[0] : return address | 2088 // -- rsp[0] : return address |
| 2087 // ----------------------------------- | 2089 // ----------------------------------- |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 __ push(receiver); | 2132 __ push(receiver); |
| 2131 __ push(value); | 2133 __ push(value); |
| 2132 __ push(scratch); // return address | 2134 __ push(scratch); // return address |
| 2133 | 2135 |
| 2134 ExternalReference ref = | 2136 ExternalReference ref = |
| 2135 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate()); | 2137 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate()); |
| 2136 __ TailCallExternalReference(ref, 2, 1); | 2138 __ TailCallExternalReference(ref, 2, 1); |
| 2137 | 2139 |
| 2138 __ bind(&miss); | 2140 __ bind(&miss); |
| 2139 | 2141 |
| 2140 StubCompiler::TailCallBuiltin(masm, StubCompiler::MissBuiltin(kind())); | 2142 StubCompiler::TailCallBuiltin( |
| 2143 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind())); |
| 2141 } | 2144 } |
| 2142 | 2145 |
| 2143 | 2146 |
| 2144 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 2147 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
| 2145 // The key is in rdx and the parameter count is in rax. | 2148 // The key is in rdx and the parameter count is in rax. |
| 2146 | 2149 |
| 2147 // The displacement is used for skipping the frame pointer on the | 2150 // The displacement is used for skipping the frame pointer on the |
| 2148 // stack. It is the offset of the last parameter (if any) relative | 2151 // stack. It is the offset of the last parameter (if any) relative |
| 2149 // to the frame pointer. | 2152 // to the frame pointer. |
| 2150 static const int kDisplacement = 1 * kPointerSize; | 2153 static const int kDisplacement = 1 * kPointerSize; |
| (...skipping 4408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6559 __ j(equal, &normal_sequence); | 6562 __ j(equal, &normal_sequence); |
| 6560 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset)); | 6563 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset)); |
| 6561 Handle<Map> allocation_site_map( | 6564 Handle<Map> allocation_site_map( |
| 6562 masm->isolate()->heap()->allocation_site_map(), | 6565 masm->isolate()->heap()->allocation_site_map(), |
| 6563 masm->isolate()); | 6566 masm->isolate()); |
| 6564 __ Cmp(FieldOperand(rcx, 0), allocation_site_map); | 6567 __ Cmp(FieldOperand(rcx, 0), allocation_site_map); |
| 6565 __ j(not_equal, &normal_sequence); | 6568 __ j(not_equal, &normal_sequence); |
| 6566 | 6569 |
| 6567 // Save the resulting elements kind in type info | 6570 // Save the resulting elements kind in type info |
| 6568 __ Integer32ToSmi(rdx, rdx); | 6571 __ Integer32ToSmi(rdx, rdx); |
| 6569 __ movq(FieldOperand(rcx, AllocationSite::kPayloadOffset), rdx); | 6572 __ movq(FieldOperand(rcx, AllocationSite::kTransitionInfoOffset), rdx); |
| 6570 __ SmiToInteger32(rdx, rdx); | 6573 __ SmiToInteger32(rdx, rdx); |
| 6571 | 6574 |
| 6572 __ bind(&normal_sequence); | 6575 __ bind(&normal_sequence); |
| 6573 int last_index = GetSequenceIndexFromFastElementsKind( | 6576 int last_index = GetSequenceIndexFromFastElementsKind( |
| 6574 TERMINAL_FAST_ELEMENTS_KIND); | 6577 TERMINAL_FAST_ELEMENTS_KIND); |
| 6575 for (int i = 0; i <= last_index; ++i) { | 6578 for (int i = 0; i <= last_index; ++i) { |
| 6576 Label next; | 6579 Label next; |
| 6577 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 6580 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
| 6578 __ cmpl(rdx, Immediate(kind)); | 6581 __ cmpl(rdx, Immediate(kind)); |
| 6579 __ j(not_equal, &next); | 6582 __ j(not_equal, &next); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6666 Label no_info, switch_ready; | 6669 Label no_info, switch_ready; |
| 6667 // Get the elements kind and case on that. | 6670 // Get the elements kind and case on that. |
| 6668 __ Cmp(rbx, undefined_sentinel); | 6671 __ Cmp(rbx, undefined_sentinel); |
| 6669 __ j(equal, &no_info); | 6672 __ j(equal, &no_info); |
| 6670 __ movq(rdx, FieldOperand(rbx, Cell::kValueOffset)); | 6673 __ movq(rdx, FieldOperand(rbx, Cell::kValueOffset)); |
| 6671 | 6674 |
| 6672 // The type cell may have undefined in its value. | 6675 // The type cell may have undefined in its value. |
| 6673 __ Cmp(rdx, undefined_sentinel); | 6676 __ Cmp(rdx, undefined_sentinel); |
| 6674 __ j(equal, &no_info); | 6677 __ j(equal, &no_info); |
| 6675 | 6678 |
| 6676 // We should have an allocation site object | 6679 // The type cell has either an AllocationSite or a JSFunction |
| 6677 if (FLAG_debug_code) { | 6680 __ Cmp(FieldOperand(rdx, 0), |
| 6678 __ Cmp(FieldOperand(rdx, 0), | 6681 Handle<Map>(masm->isolate()->heap()->allocation_site_map())); |
| 6679 Handle<Map>(masm->isolate()->heap()->allocation_site_map())); | 6682 __ j(not_equal, &no_info); |
| 6680 __ Assert(equal, "Expected AllocationSite object in register rdx"); | |
| 6681 } | |
| 6682 | 6683 |
| 6683 __ movq(rdx, FieldOperand(rdx, AllocationSite::kPayloadOffset)); | 6684 __ movq(rdx, FieldOperand(rdx, AllocationSite::kTransitionInfoOffset)); |
| 6684 __ SmiToInteger32(rdx, rdx); | 6685 __ SmiToInteger32(rdx, rdx); |
| 6685 __ jmp(&switch_ready); | 6686 __ jmp(&switch_ready); |
| 6686 __ bind(&no_info); | 6687 __ bind(&no_info); |
| 6687 __ movq(rdx, Immediate(GetInitialFastElementsKind())); | 6688 __ movq(rdx, Immediate(GetInitialFastElementsKind())); |
| 6688 __ bind(&switch_ready); | 6689 __ bind(&switch_ready); |
| 6689 | 6690 |
| 6690 if (argument_count_ == ANY) { | 6691 if (argument_count_ == ANY) { |
| 6691 Label not_zero_case, not_one_case; | 6692 Label not_zero_case, not_one_case; |
| 6692 __ testq(rax, rax); | 6693 __ testq(rax, rax); |
| 6693 __ j(not_zero, ¬_zero_case); | 6694 __ j(not_zero, ¬_zero_case); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6799 __ bind(&fast_elements_case); | 6800 __ bind(&fast_elements_case); |
| 6800 GenerateCase(masm, FAST_ELEMENTS); | 6801 GenerateCase(masm, FAST_ELEMENTS); |
| 6801 } | 6802 } |
| 6802 | 6803 |
| 6803 | 6804 |
| 6804 #undef __ | 6805 #undef __ |
| 6805 | 6806 |
| 6806 } } // namespace v8::internal | 6807 } } // namespace v8::internal |
| 6807 | 6808 |
| 6808 #endif // V8_TARGET_ARCH_X64 | 6809 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |