| 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 3120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3131 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); | 3131 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); |
| 3132 __ j(below, &build_args); | 3132 __ j(below, &build_args); |
| 3133 | 3133 |
| 3134 // Check that applicand.apply is Function.prototype.apply. | 3134 // Check that applicand.apply is Function.prototype.apply. |
| 3135 __ mov(eax, Operand(esp, kPointerSize)); | 3135 __ mov(eax, Operand(esp, kPointerSize)); |
| 3136 __ test(eax, Immediate(kSmiTagMask)); | 3136 __ test(eax, Immediate(kSmiTagMask)); |
| 3137 __ j(zero, &build_args); | 3137 __ j(zero, &build_args); |
| 3138 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ecx); | 3138 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ecx); |
| 3139 __ j(not_equal, &build_args); | 3139 __ j(not_equal, &build_args); |
| 3140 __ mov(ecx, FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset)); | 3140 __ mov(ecx, FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset)); |
| 3141 Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply)); | 3141 Handle<Code> apply_code(Isolate::Current()->builtins()->builtin( |
| 3142 Builtins::FunctionApply)); |
| 3142 __ cmp(FieldOperand(ecx, SharedFunctionInfo::kCodeOffset), | 3143 __ cmp(FieldOperand(ecx, SharedFunctionInfo::kCodeOffset), |
| 3143 Immediate(apply_code)); | 3144 Immediate(apply_code)); |
| 3144 __ j(not_equal, &build_args); | 3145 __ j(not_equal, &build_args); |
| 3145 | 3146 |
| 3146 // Check that applicand is a function. | 3147 // Check that applicand is a function. |
| 3147 __ mov(edi, Operand(esp, 2 * kPointerSize)); | 3148 __ mov(edi, Operand(esp, 2 * kPointerSize)); |
| 3148 __ test(edi, Immediate(kSmiTagMask)); | 3149 __ test(edi, Immediate(kSmiTagMask)); |
| 3149 __ j(zero, &build_args); | 3150 __ j(zero, &build_args); |
| 3150 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 3151 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
| 3151 __ j(not_equal, &build_args); | 3152 __ j(not_equal, &build_args); |
| (...skipping 4271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7423 | 7424 |
| 7424 | 7425 |
| 7425 void CodeGenerator::VisitCallRuntime(CallRuntime* node) { | 7426 void CodeGenerator::VisitCallRuntime(CallRuntime* node) { |
| 7426 ASSERT(!in_safe_int32_mode()); | 7427 ASSERT(!in_safe_int32_mode()); |
| 7427 if (CheckForInlineRuntimeCall(node)) { | 7428 if (CheckForInlineRuntimeCall(node)) { |
| 7428 return; | 7429 return; |
| 7429 } | 7430 } |
| 7430 | 7431 |
| 7431 ZoneList<Expression*>* args = node->arguments(); | 7432 ZoneList<Expression*>* args = node->arguments(); |
| 7432 Comment cmnt(masm_, "[ CallRuntime"); | 7433 Comment cmnt(masm_, "[ CallRuntime"); |
| 7433 Runtime::Function* function = node->function(); | 7434 const Runtime::Function* function = node->function(); |
| 7434 | 7435 |
| 7435 if (function == NULL) { | 7436 if (function == NULL) { |
| 7436 // Push the builtins object found in the current global object. | 7437 // Push the builtins object found in the current global object. |
| 7437 Result temp = allocator()->Allocate(); | 7438 Result temp = allocator()->Allocate(); |
| 7438 ASSERT(temp.is_valid()); | 7439 ASSERT(temp.is_valid()); |
| 7439 __ mov(temp.reg(), GlobalObject()); | 7440 __ mov(temp.reg(), GlobalObject()); |
| 7440 __ mov(temp.reg(), FieldOperand(temp.reg(), GlobalObject::kBuiltinsOffset)); | 7441 __ mov(temp.reg(), FieldOperand(temp.reg(), GlobalObject::kBuiltinsOffset)); |
| 7441 frame_->Push(&temp); | 7442 frame_->Push(&temp); |
| 7442 } | 7443 } |
| 7443 | 7444 |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8554 Register receiver_; | 8555 Register receiver_; |
| 8555 Handle<String> name_; | 8556 Handle<String> name_; |
| 8556 }; | 8557 }; |
| 8557 | 8558 |
| 8558 | 8559 |
| 8559 void DeferredReferenceGetNamedValue::Generate() { | 8560 void DeferredReferenceGetNamedValue::Generate() { |
| 8560 if (!receiver_.is(eax)) { | 8561 if (!receiver_.is(eax)) { |
| 8561 __ mov(eax, receiver_); | 8562 __ mov(eax, receiver_); |
| 8562 } | 8563 } |
| 8563 __ Set(ecx, Immediate(name_)); | 8564 __ Set(ecx, Immediate(name_)); |
| 8564 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 8565 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 8566 Builtins::LoadIC_Initialize)); |
| 8565 __ call(ic, RelocInfo::CODE_TARGET); | 8567 __ call(ic, RelocInfo::CODE_TARGET); |
| 8566 // The call must be followed by a test eax instruction to indicate | 8568 // The call must be followed by a test eax instruction to indicate |
| 8567 // that the inobject property case was inlined. | 8569 // that the inobject property case was inlined. |
| 8568 // | 8570 // |
| 8569 // Store the delta to the map check instruction here in the test | 8571 // Store the delta to the map check instruction here in the test |
| 8570 // instruction. Use masm_-> instead of the __ macro since the | 8572 // instruction. Use masm_-> instead of the __ macro since the |
| 8571 // latter can't return a value. | 8573 // latter can't return a value. |
| 8572 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 8574 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
| 8573 // Here we use masm_-> instead of the __ macro because this is the | 8575 // Here we use masm_-> instead of the __ macro because this is the |
| 8574 // instruction that gets patched and coverage code gets in the way. | 8576 // instruction that gets patched and coverage code gets in the way. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8619 } | 8621 } |
| 8620 } else { | 8622 } else { |
| 8621 __ xchg(edx, eax); | 8623 __ xchg(edx, eax); |
| 8622 } | 8624 } |
| 8623 // Calculate the delta from the IC call instruction to the map check | 8625 // Calculate the delta from the IC call instruction to the map check |
| 8624 // cmp instruction in the inlined version. This delta is stored in | 8626 // cmp instruction in the inlined version. This delta is stored in |
| 8625 // a test(eax, delta) instruction after the call so that we can find | 8627 // a test(eax, delta) instruction after the call so that we can find |
| 8626 // it in the IC initialization code and patch the cmp instruction. | 8628 // it in the IC initialization code and patch the cmp instruction. |
| 8627 // This means that we cannot allow test instructions after calls to | 8629 // This means that we cannot allow test instructions after calls to |
| 8628 // KeyedLoadIC stubs in other places. | 8630 // KeyedLoadIC stubs in other places. |
| 8629 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 8631 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 8632 Builtins::KeyedLoadIC_Initialize)); |
| 8630 __ call(ic, RelocInfo::CODE_TARGET); | 8633 __ call(ic, RelocInfo::CODE_TARGET); |
| 8631 // The delta from the start of the map-compare instruction to the | 8634 // The delta from the start of the map-compare instruction to the |
| 8632 // test instruction. We use masm_-> directly here instead of the __ | 8635 // test instruction. We use masm_-> directly here instead of the __ |
| 8633 // macro because the macro sometimes uses macro expansion to turn | 8636 // macro because the macro sometimes uses macro expansion to turn |
| 8634 // into something that can't return a value. This is encountered | 8637 // into something that can't return a value. This is encountered |
| 8635 // when doing generated code coverage tests. | 8638 // when doing generated code coverage tests. |
| 8636 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 8639 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
| 8637 // Here we use masm_-> instead of the __ macro because this is the | 8640 // Here we use masm_-> instead of the __ macro because this is the |
| 8638 // instruction that gets patched and coverage code gets in the way. | 8641 // instruction that gets patched and coverage code gets in the way. |
| 8639 masm_->test(eax, Immediate(-delta_to_patch_site)); | 8642 masm_->test(eax, Immediate(-delta_to_patch_site)); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8717 } | 8720 } |
| 8718 } | 8721 } |
| 8719 } else { // Key is not in edx or ecx. | 8722 } else { // Key is not in edx or ecx. |
| 8720 if (!receiver_.is(edx)) { | 8723 if (!receiver_.is(edx)) { |
| 8721 __ mov(edx, receiver_); | 8724 __ mov(edx, receiver_); |
| 8722 } | 8725 } |
| 8723 __ mov(ecx, key_); | 8726 __ mov(ecx, key_); |
| 8724 } | 8727 } |
| 8725 | 8728 |
| 8726 // Call the IC stub. | 8729 // Call the IC stub. |
| 8727 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 8730 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 8731 Builtins::KeyedStoreIC_Initialize)); |
| 8728 __ call(ic, RelocInfo::CODE_TARGET); | 8732 __ call(ic, RelocInfo::CODE_TARGET); |
| 8729 // The delta from the start of the map-compare instruction to the | 8733 // The delta from the start of the map-compare instruction to the |
| 8730 // test instruction. We use masm_-> directly here instead of the | 8734 // test instruction. We use masm_-> directly here instead of the |
| 8731 // __ macro because the macro sometimes uses macro expansion to turn | 8735 // __ macro because the macro sometimes uses macro expansion to turn |
| 8732 // into something that can't return a value. This is encountered | 8736 // into something that can't return a value. This is encountered |
| 8733 // when doing generated code coverage tests. | 8737 // when doing generated code coverage tests. |
| 8734 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 8738 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
| 8735 // Here we use masm_-> instead of the __ macro because this is the | 8739 // Here we use masm_-> instead of the __ macro because this is the |
| 8736 // instruction that gets patched and coverage code gets in the way. | 8740 // instruction that gets patched and coverage code gets in the way. |
| 8737 masm_->test(eax, Immediate(-delta_to_patch_site)); | 8741 masm_->test(eax, Immediate(-delta_to_patch_site)); |
| (...skipping 3269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12007 __ InvokeFunction(edi, actual, JUMP_FUNCTION); | 12011 __ InvokeFunction(edi, actual, JUMP_FUNCTION); |
| 12008 | 12012 |
| 12009 // Slow-case: Non-function called. | 12013 // Slow-case: Non-function called. |
| 12010 __ bind(&slow); | 12014 __ bind(&slow); |
| 12011 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 12015 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
| 12012 // of the original receiver from the call site). | 12016 // of the original receiver from the call site). |
| 12013 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi); | 12017 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi); |
| 12014 __ Set(eax, Immediate(argc_)); | 12018 __ Set(eax, Immediate(argc_)); |
| 12015 __ Set(ebx, Immediate(0)); | 12019 __ Set(ebx, Immediate(0)); |
| 12016 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); | 12020 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); |
| 12017 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); | 12021 Handle<Code> adaptor(Isolate::Current()->builtins()->builtin( |
| 12022 Builtins::ArgumentsAdaptorTrampoline)); |
| 12018 __ jmp(adaptor, RelocInfo::CODE_TARGET); | 12023 __ jmp(adaptor, RelocInfo::CODE_TARGET); |
| 12019 } | 12024 } |
| 12020 | 12025 |
| 12021 | 12026 |
| 12022 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { | 12027 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { |
| 12023 // eax holds the exception. | 12028 // eax holds the exception. |
| 12024 | 12029 |
| 12025 // Adjust this code if not the case. | 12030 // Adjust this code if not the case. |
| 12026 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); | 12031 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); |
| 12027 | 12032 |
| (...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13722 masm.GetCode(&desc); | 13727 masm.GetCode(&desc); |
| 13723 // Call the function from C++. | 13728 // Call the function from C++. |
| 13724 return FUNCTION_CAST<MemCopyFunction>(buffer); | 13729 return FUNCTION_CAST<MemCopyFunction>(buffer); |
| 13725 } | 13730 } |
| 13726 | 13731 |
| 13727 #undef __ | 13732 #undef __ |
| 13728 | 13733 |
| 13729 } } // namespace v8::internal | 13734 } } // namespace v8::internal |
| 13730 | 13735 |
| 13731 #endif // V8_TARGET_ARCH_IA32 | 13736 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |