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 3329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3340 | 3340 |
3341 // Check that applicand.apply is Function.prototype.apply. | 3341 // Check that applicand.apply is Function.prototype.apply. |
3342 __ mov(eax, Operand(esp, kPointerSize)); | 3342 __ mov(eax, Operand(esp, kPointerSize)); |
3343 __ test(eax, Immediate(kSmiTagMask)); | 3343 __ test(eax, Immediate(kSmiTagMask)); |
3344 __ j(zero, &build_args); | 3344 __ j(zero, &build_args); |
3345 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ecx); | 3345 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ecx); |
3346 __ j(not_equal, &build_args); | 3346 __ j(not_equal, &build_args); |
3347 __ mov(ecx, FieldOperand(eax, JSFunction::kCodeEntryOffset)); | 3347 __ mov(ecx, FieldOperand(eax, JSFunction::kCodeEntryOffset)); |
3348 __ sub(Operand(ecx), Immediate(Code::kHeaderSize - kHeapObjectTag)); | 3348 __ sub(Operand(ecx), Immediate(Code::kHeaderSize - kHeapObjectTag)); |
3349 Handle<Code> apply_code(masm()->isolate()->builtins()->builtin( | 3349 Handle<Code> apply_code(masm()->isolate()->builtins()->builtin( |
3350 Builtins::FunctionApply)); | 3350 Builtins::kFunctionApply)); |
3351 __ cmp(Operand(ecx), Immediate(apply_code)); | 3351 __ cmp(Operand(ecx), Immediate(apply_code)); |
3352 __ j(not_equal, &build_args); | 3352 __ j(not_equal, &build_args); |
3353 | 3353 |
3354 // Check that applicand is a function. | 3354 // Check that applicand is a function. |
3355 __ mov(edi, Operand(esp, 2 * kPointerSize)); | 3355 __ mov(edi, Operand(esp, 2 * kPointerSize)); |
3356 __ test(edi, Immediate(kSmiTagMask)); | 3356 __ test(edi, Immediate(kSmiTagMask)); |
3357 __ j(zero, &build_args); | 3357 __ j(zero, &build_args); |
3358 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 3358 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
3359 __ j(not_equal, &build_args); | 3359 __ j(not_equal, &build_args); |
3360 | 3360 |
(...skipping 6024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9385 bool is_dont_delete_; | 9385 bool is_dont_delete_; |
9386 }; | 9386 }; |
9387 | 9387 |
9388 | 9388 |
9389 void DeferredReferenceGetNamedValue::Generate() { | 9389 void DeferredReferenceGetNamedValue::Generate() { |
9390 if (!receiver_.is(eax)) { | 9390 if (!receiver_.is(eax)) { |
9391 __ mov(eax, receiver_); | 9391 __ mov(eax, receiver_); |
9392 } | 9392 } |
9393 __ Set(ecx, Immediate(name_)); | 9393 __ Set(ecx, Immediate(name_)); |
9394 Handle<Code> ic(masm()->isolate()->builtins()->builtin( | 9394 Handle<Code> ic(masm()->isolate()->builtins()->builtin( |
9395 Builtins::LoadIC_Initialize)); | 9395 Builtins::kLoadIC_Initialize)); |
9396 RelocInfo::Mode mode = is_contextual_ | 9396 RelocInfo::Mode mode = is_contextual_ |
9397 ? RelocInfo::CODE_TARGET_CONTEXT | 9397 ? RelocInfo::CODE_TARGET_CONTEXT |
9398 : RelocInfo::CODE_TARGET; | 9398 : RelocInfo::CODE_TARGET; |
9399 __ call(ic, mode); | 9399 __ call(ic, mode); |
9400 // The call must be followed by: | 9400 // The call must be followed by: |
9401 // - a test eax instruction to indicate that the inobject property | 9401 // - a test eax instruction to indicate that the inobject property |
9402 // case was inlined. | 9402 // case was inlined. |
9403 // - a mov ecx or mov edx instruction to indicate that the | 9403 // - a mov ecx or mov edx instruction to indicate that the |
9404 // contextual property load was inlined. | 9404 // contextual property load was inlined. |
9405 // | 9405 // |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9465 } else { | 9465 } else { |
9466 __ xchg(edx, eax); | 9466 __ xchg(edx, eax); |
9467 } | 9467 } |
9468 // Calculate the delta from the IC call instruction to the map check | 9468 // Calculate the delta from the IC call instruction to the map check |
9469 // cmp instruction in the inlined version. This delta is stored in | 9469 // cmp instruction in the inlined version. This delta is stored in |
9470 // a test(eax, delta) instruction after the call so that we can find | 9470 // a test(eax, delta) instruction after the call so that we can find |
9471 // it in the IC initialization code and patch the cmp instruction. | 9471 // it in the IC initialization code and patch the cmp instruction. |
9472 // This means that we cannot allow test instructions after calls to | 9472 // This means that we cannot allow test instructions after calls to |
9473 // KeyedLoadIC stubs in other places. | 9473 // KeyedLoadIC stubs in other places. |
9474 Handle<Code> ic(masm()->isolate()->builtins()->builtin( | 9474 Handle<Code> ic(masm()->isolate()->builtins()->builtin( |
9475 Builtins::KeyedLoadIC_Initialize)); | 9475 Builtins::kKeyedLoadIC_Initialize)); |
9476 __ call(ic, RelocInfo::CODE_TARGET); | 9476 __ call(ic, RelocInfo::CODE_TARGET); |
9477 // The delta from the start of the map-compare instruction to the | 9477 // The delta from the start of the map-compare instruction to the |
9478 // test instruction. We use masm_-> directly here instead of the __ | 9478 // test instruction. We use masm_-> directly here instead of the __ |
9479 // macro because the macro sometimes uses macro expansion to turn | 9479 // macro because the macro sometimes uses macro expansion to turn |
9480 // into something that can't return a value. This is encountered | 9480 // into something that can't return a value. This is encountered |
9481 // when doing generated code coverage tests. | 9481 // when doing generated code coverage tests. |
9482 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 9482 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
9483 // Here we use masm_-> instead of the __ macro because this is the | 9483 // Here we use masm_-> instead of the __ macro because this is the |
9484 // instruction that gets patched and coverage code gets in the way. | 9484 // instruction that gets patched and coverage code gets in the way. |
9485 masm_->test(eax, Immediate(-delta_to_patch_site)); | 9485 masm_->test(eax, Immediate(-delta_to_patch_site)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9567 } | 9567 } |
9568 } else { // Key is not in edx or ecx. | 9568 } else { // Key is not in edx or ecx. |
9569 if (!receiver_.is(edx)) { | 9569 if (!receiver_.is(edx)) { |
9570 __ mov(edx, receiver_); | 9570 __ mov(edx, receiver_); |
9571 } | 9571 } |
9572 __ mov(ecx, key_); | 9572 __ mov(ecx, key_); |
9573 } | 9573 } |
9574 | 9574 |
9575 // Call the IC stub. | 9575 // Call the IC stub. |
9576 Handle<Code> ic(masm()->isolate()->builtins()->builtin( | 9576 Handle<Code> ic(masm()->isolate()->builtins()->builtin( |
9577 (strict_mode_ == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict | 9577 (strict_mode_ == kStrictMode) ? Builtins::kKeyedStoreIC_Initialize_Strict |
9578 : Builtins::KeyedStoreIC_Initialize)); | 9578 : Builtins::kKeyedStoreIC_Initialize)); |
9579 __ call(ic, RelocInfo::CODE_TARGET); | 9579 __ call(ic, RelocInfo::CODE_TARGET); |
9580 // The delta from the start of the map-compare instruction to the | 9580 // The delta from the start of the map-compare instruction to the |
9581 // test instruction. We use masm_-> directly here instead of the | 9581 // test instruction. We use masm_-> directly here instead of the |
9582 // __ macro because the macro sometimes uses macro expansion to turn | 9582 // __ macro because the macro sometimes uses macro expansion to turn |
9583 // into something that can't return a value. This is encountered | 9583 // into something that can't return a value. This is encountered |
9584 // when doing generated code coverage tests. | 9584 // when doing generated code coverage tests. |
9585 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 9585 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
9586 // Here we use masm_-> instead of the __ macro because this is the | 9586 // Here we use masm_-> instead of the __ macro because this is the |
9587 // instruction that gets patched and coverage code gets in the way. | 9587 // instruction that gets patched and coverage code gets in the way. |
9588 masm_->test(eax, Immediate(-delta_to_patch_site)); | 9588 masm_->test(eax, Immediate(-delta_to_patch_site)); |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10370 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); | 10370 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); |
10371 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); | 10371 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); |
10372 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); | 10372 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); |
10373 } | 10373 } |
10374 | 10374 |
10375 #undef __ | 10375 #undef __ |
10376 | 10376 |
10377 } } // namespace v8::internal | 10377 } } // namespace v8::internal |
10378 | 10378 |
10379 #endif // V8_TARGET_ARCH_IA32 | 10379 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |