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 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 __ j(below, &build_args); | 2554 __ j(below, &build_args); |
2555 | 2555 |
2556 // Check that applicand.apply is Function.prototype.apply. | 2556 // Check that applicand.apply is Function.prototype.apply. |
2557 __ movq(rax, Operand(rsp, kPointerSize)); | 2557 __ movq(rax, Operand(rsp, kPointerSize)); |
2558 is_smi = masm_->CheckSmi(rax); | 2558 is_smi = masm_->CheckSmi(rax); |
2559 __ j(is_smi, &build_args); | 2559 __ j(is_smi, &build_args); |
2560 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rcx); | 2560 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rcx); |
2561 __ j(not_equal, &build_args); | 2561 __ j(not_equal, &build_args); |
2562 __ movq(rcx, FieldOperand(rax, JSFunction::kCodeEntryOffset)); | 2562 __ movq(rcx, FieldOperand(rax, JSFunction::kCodeEntryOffset)); |
2563 __ subq(rcx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 2563 __ subq(rcx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
2564 Handle<Code> apply_code(Isolate::Current()->builtins()->builtin( | 2564 Handle<Code> apply_code = Isolate::Current()->builtins()->FunctionApply(); |
2565 Builtins::FunctionApply)); | |
2566 __ Cmp(rcx, apply_code); | 2565 __ Cmp(rcx, apply_code); |
2567 __ j(not_equal, &build_args); | 2566 __ j(not_equal, &build_args); |
2568 | 2567 |
2569 // Check that applicand is a function. | 2568 // Check that applicand is a function. |
2570 __ movq(rdi, Operand(rsp, 2 * kPointerSize)); | 2569 __ movq(rdi, Operand(rsp, 2 * kPointerSize)); |
2571 is_smi = masm_->CheckSmi(rdi); | 2570 is_smi = masm_->CheckSmi(rdi); |
2572 __ j(is_smi, &build_args); | 2571 __ j(is_smi, &build_args); |
2573 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 2572 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); |
2574 __ j(not_equal, &build_args); | 2573 __ j(not_equal, &build_args); |
2575 | 2574 |
(...skipping 5415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7991 Register receiver_; | 7990 Register receiver_; |
7992 Handle<String> name_; | 7991 Handle<String> name_; |
7993 }; | 7992 }; |
7994 | 7993 |
7995 | 7994 |
7996 void DeferredReferenceGetNamedValue::Generate() { | 7995 void DeferredReferenceGetNamedValue::Generate() { |
7997 if (!receiver_.is(rax)) { | 7996 if (!receiver_.is(rax)) { |
7998 __ movq(rax, receiver_); | 7997 __ movq(rax, receiver_); |
7999 } | 7998 } |
8000 __ Move(rcx, name_); | 7999 __ Move(rcx, name_); |
8001 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 8000 Handle<Code> ic = Isolate::Current()->builtins()->LoadIC_Initialize(); |
8002 Builtins::LoadIC_Initialize)); | |
8003 __ Call(ic, RelocInfo::CODE_TARGET); | 8001 __ Call(ic, RelocInfo::CODE_TARGET); |
8004 // The call must be followed by a test rax instruction to indicate | 8002 // The call must be followed by a test rax instruction to indicate |
8005 // that the inobject property case was inlined. | 8003 // that the inobject property case was inlined. |
8006 // | 8004 // |
8007 // Store the delta to the map check instruction here in the test | 8005 // Store the delta to the map check instruction here in the test |
8008 // instruction. Use masm_-> instead of the __ macro since the | 8006 // instruction. Use masm_-> instead of the __ macro since the |
8009 // latter can't return a value. | 8007 // latter can't return a value. |
8010 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 8008 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
8011 // Here we use masm_-> instead of the __ macro because this is the | 8009 // Here we use masm_-> instead of the __ macro because this is the |
8012 // instruction that gets patched and coverage code gets in the way. | 8010 // instruction that gets patched and coverage code gets in the way. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8057 } else { | 8055 } else { |
8058 __ movq(rax, key_); | 8056 __ movq(rax, key_); |
8059 __ movq(rdx, receiver_); | 8057 __ movq(rdx, receiver_); |
8060 } | 8058 } |
8061 // Calculate the delta from the IC call instruction to the map check | 8059 // Calculate the delta from the IC call instruction to the map check |
8062 // movq instruction in the inlined version. This delta is stored in | 8060 // movq instruction in the inlined version. This delta is stored in |
8063 // a test(rax, delta) instruction after the call so that we can find | 8061 // a test(rax, delta) instruction after the call so that we can find |
8064 // it in the IC initialization code and patch the movq instruction. | 8062 // it in the IC initialization code and patch the movq instruction. |
8065 // This means that we cannot allow test instructions after calls to | 8063 // This means that we cannot allow test instructions after calls to |
8066 // KeyedLoadIC stubs in other places. | 8064 // KeyedLoadIC stubs in other places. |
8067 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 8065 Handle<Code> ic = Isolate::Current()->builtins()->KeyedLoadIC_Initialize(); |
8068 Builtins::KeyedLoadIC_Initialize)); | |
8069 __ Call(ic, RelocInfo::CODE_TARGET); | 8066 __ Call(ic, RelocInfo::CODE_TARGET); |
8070 // The delta from the start of the map-compare instruction to the | 8067 // The delta from the start of the map-compare instruction to the |
8071 // test instruction. We use masm_-> directly here instead of the __ | 8068 // test instruction. We use masm_-> directly here instead of the __ |
8072 // macro because the macro sometimes uses macro expansion to turn | 8069 // macro because the macro sometimes uses macro expansion to turn |
8073 // into something that can't return a value. This is encountered | 8070 // into something that can't return a value. This is encountered |
8074 // when doing generated code coverage tests. | 8071 // when doing generated code coverage tests. |
8075 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 8072 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
8076 // Here we use masm_-> instead of the __ macro because this is the | 8073 // Here we use masm_-> instead of the __ macro because this is the |
8077 // instruction that gets patched and coverage code gets in the way. | 8074 // instruction that gets patched and coverage code gets in the way. |
8078 // TODO(X64): Consider whether it's worth switching the test to a | 8075 // TODO(X64): Consider whether it's worth switching the test to a |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8153 } | 8150 } |
8154 } else if (key_.is(rcx)) { | 8151 } else if (key_.is(rcx)) { |
8155 __ movq(rdx, receiver_); | 8152 __ movq(rdx, receiver_); |
8156 } else { | 8153 } else { |
8157 __ movq(rcx, key_); | 8154 __ movq(rcx, key_); |
8158 __ movq(rdx, receiver_); | 8155 __ movq(rdx, receiver_); |
8159 } | 8156 } |
8160 | 8157 |
8161 // Call the IC stub. | 8158 // Call the IC stub. |
8162 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 8159 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
8163 (strict_mode_ == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict | 8160 (strict_mode_ == kStrictMode) ? Builtins::kKeyedStoreIC_Initialize_Strict |
8164 : Builtins::KeyedStoreIC_Initialize)); | 8161 : Builtins::kKeyedStoreIC_Initialize)); |
8165 __ Call(ic, RelocInfo::CODE_TARGET); | 8162 __ Call(ic, RelocInfo::CODE_TARGET); |
8166 // The delta from the start of the map-compare instructions (initial movq) | 8163 // The delta from the start of the map-compare instructions (initial movq) |
8167 // to the test instruction. We use masm_-> directly here instead of the | 8164 // to the test instruction. We use masm_-> directly here instead of the |
8168 // __ macro because the macro sometimes uses macro expansion to turn | 8165 // __ macro because the macro sometimes uses macro expansion to turn |
8169 // into something that can't return a value. This is encountered | 8166 // into something that can't return a value. This is encountered |
8170 // when doing generated code coverage tests. | 8167 // when doing generated code coverage tests. |
8171 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 8168 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
8172 // Here we use masm_-> instead of the __ macro because this is the | 8169 // Here we use masm_-> instead of the __ macro because this is the |
8173 // instruction that gets patched and coverage code gets in the way. | 8170 // instruction that gets patched and coverage code gets in the way. |
8174 masm_->testl(rax, Immediate(-delta_to_patch_site)); | 8171 masm_->testl(rax, Immediate(-delta_to_patch_site)); |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8841 } | 8838 } |
8842 | 8839 |
8843 #endif | 8840 #endif |
8844 | 8841 |
8845 | 8842 |
8846 #undef __ | 8843 #undef __ |
8847 | 8844 |
8848 } } // namespace v8::internal | 8845 } } // namespace v8::internal |
8849 | 8846 |
8850 #endif // V8_TARGET_ARCH_X64 | 8847 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |