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 5416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7992 Register receiver_; | 7991 Register receiver_; |
7993 Handle<String> name_; | 7992 Handle<String> name_; |
7994 }; | 7993 }; |
7995 | 7994 |
7996 | 7995 |
7997 void DeferredReferenceGetNamedValue::Generate() { | 7996 void DeferredReferenceGetNamedValue::Generate() { |
7998 if (!receiver_.is(rax)) { | 7997 if (!receiver_.is(rax)) { |
7999 __ movq(rax, receiver_); | 7998 __ movq(rax, receiver_); |
8000 } | 7999 } |
8001 __ Move(rcx, name_); | 8000 __ Move(rcx, name_); |
8002 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 8001 Handle<Code> ic = Isolate::Current()->builtins()->LoadIC_Initialize(); |
8003 Builtins::LoadIC_Initialize)); | |
8004 __ Call(ic, RelocInfo::CODE_TARGET); | 8002 __ Call(ic, RelocInfo::CODE_TARGET); |
8005 // The call must be followed by a test rax instruction to indicate | 8003 // The call must be followed by a test rax instruction to indicate |
8006 // that the inobject property case was inlined. | 8004 // that the inobject property case was inlined. |
8007 // | 8005 // |
8008 // Store the delta to the map check instruction here in the test | 8006 // Store the delta to the map check instruction here in the test |
8009 // instruction. Use masm_-> instead of the __ macro since the | 8007 // instruction. Use masm_-> instead of the __ macro since the |
8010 // latter can't return a value. | 8008 // latter can't return a value. |
8011 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 8009 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
8012 // Here we use masm_-> instead of the __ macro because this is the | 8010 // Here we use masm_-> instead of the __ macro because this is the |
8013 // instruction that gets patched and coverage code gets in the way. | 8011 // instruction that gets patched and coverage code gets in the way. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8059 } else { | 8057 } else { |
8060 __ movq(rax, key_); | 8058 __ movq(rax, key_); |
8061 __ movq(rdx, receiver_); | 8059 __ movq(rdx, receiver_); |
8062 } | 8060 } |
8063 // Calculate the delta from the IC call instruction to the map check | 8061 // Calculate the delta from the IC call instruction to the map check |
8064 // movq instruction in the inlined version. This delta is stored in | 8062 // movq instruction in the inlined version. This delta is stored in |
8065 // a test(rax, delta) instruction after the call so that we can find | 8063 // a test(rax, delta) instruction after the call so that we can find |
8066 // it in the IC initialization code and patch the movq instruction. | 8064 // it in the IC initialization code and patch the movq instruction. |
8067 // This means that we cannot allow test instructions after calls to | 8065 // This means that we cannot allow test instructions after calls to |
8068 // KeyedLoadIC stubs in other places. | 8066 // KeyedLoadIC stubs in other places. |
8069 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 8067 Handle<Code> ic = Isolate::Current()->builtins()->KeyedLoadIC_Initialize(); |
8070 Builtins::KeyedLoadIC_Initialize)); | |
8071 __ Call(ic, RelocInfo::CODE_TARGET); | 8068 __ Call(ic, RelocInfo::CODE_TARGET); |
8072 // The delta from the start of the map-compare instruction to the | 8069 // The delta from the start of the map-compare instruction to the |
8073 // test instruction. We use masm_-> directly here instead of the __ | 8070 // test instruction. We use masm_-> directly here instead of the __ |
8074 // macro because the macro sometimes uses macro expansion to turn | 8071 // macro because the macro sometimes uses macro expansion to turn |
8075 // into something that can't return a value. This is encountered | 8072 // into something that can't return a value. This is encountered |
8076 // when doing generated code coverage tests. | 8073 // when doing generated code coverage tests. |
8077 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 8074 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
8078 // Here we use masm_-> instead of the __ macro because this is the | 8075 // Here we use masm_-> instead of the __ macro because this is the |
8079 // instruction that gets patched and coverage code gets in the way. | 8076 // instruction that gets patched and coverage code gets in the way. |
8080 // TODO(X64): Consider whether it's worth switching the test to a | 8077 // TODO(X64): Consider whether it's worth switching the test to a |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8157 } | 8154 } |
8158 } else if (key_.is(rcx)) { | 8155 } else if (key_.is(rcx)) { |
8159 __ movq(rdx, receiver_); | 8156 __ movq(rdx, receiver_); |
8160 } else { | 8157 } else { |
8161 __ movq(rcx, key_); | 8158 __ movq(rcx, key_); |
8162 __ movq(rdx, receiver_); | 8159 __ movq(rdx, receiver_); |
8163 } | 8160 } |
8164 | 8161 |
8165 // Call the IC stub. | 8162 // Call the IC stub. |
8166 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 8163 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
8167 (strict_mode_ == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict | 8164 (strict_mode_ == kStrictMode) ? Builtins::kKeyedStoreIC_Initialize_Strict |
8168 : Builtins::KeyedStoreIC_Initialize)); | 8165 : Builtins::kKeyedStoreIC_Initialize)); |
8169 __ Call(ic, RelocInfo::CODE_TARGET); | 8166 __ Call(ic, RelocInfo::CODE_TARGET); |
8170 // The delta from the start of the map-compare instructions (initial movq) | 8167 // The delta from the start of the map-compare instructions (initial movq) |
8171 // to the test instruction. We use masm_-> directly here instead of the | 8168 // to the test instruction. We use masm_-> directly here instead of the |
8172 // __ macro because the macro sometimes uses macro expansion to turn | 8169 // __ macro because the macro sometimes uses macro expansion to turn |
8173 // into something that can't return a value. This is encountered | 8170 // into something that can't return a value. This is encountered |
8174 // when doing generated code coverage tests. | 8171 // when doing generated code coverage tests. |
8175 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 8172 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
8176 // Here we use masm_-> instead of the __ macro because this is the | 8173 // Here we use masm_-> instead of the __ macro because this is the |
8177 // instruction that gets patched and coverage code gets in the way. | 8174 // instruction that gets patched and coverage code gets in the way. |
8178 masm_->testl(rax, Immediate(-delta_to_patch_site)); | 8175 masm_->testl(rax, Immediate(-delta_to_patch_site)); |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8848 } | 8845 } |
8849 | 8846 |
8850 #endif | 8847 #endif |
8851 | 8848 |
8852 | 8849 |
8853 #undef __ | 8850 #undef __ |
8854 | 8851 |
8855 } } // namespace v8::internal | 8852 } } // namespace v8::internal |
8856 | 8853 |
8857 #endif // V8_TARGET_ARCH_X64 | 8854 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |