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 6025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9386 bool is_dont_delete_; | 9386 bool is_dont_delete_; |
9387 }; | 9387 }; |
9388 | 9388 |
9389 | 9389 |
9390 void DeferredReferenceGetNamedValue::Generate() { | 9390 void DeferredReferenceGetNamedValue::Generate() { |
9391 if (!receiver_.is(eax)) { | 9391 if (!receiver_.is(eax)) { |
9392 __ mov(eax, receiver_); | 9392 __ mov(eax, receiver_); |
9393 } | 9393 } |
9394 __ Set(ecx, Immediate(name_)); | 9394 __ Set(ecx, Immediate(name_)); |
9395 Handle<Code> ic(masm()->isolate()->builtins()->builtin( | 9395 Handle<Code> ic(masm()->isolate()->builtins()->builtin( |
9396 Builtins::LoadIC_Initialize)); | 9396 Builtins::kLoadIC_Initialize)); |
9397 RelocInfo::Mode mode = is_contextual_ | 9397 RelocInfo::Mode mode = is_contextual_ |
9398 ? RelocInfo::CODE_TARGET_CONTEXT | 9398 ? RelocInfo::CODE_TARGET_CONTEXT |
9399 : RelocInfo::CODE_TARGET; | 9399 : RelocInfo::CODE_TARGET; |
9400 __ call(ic, mode); | 9400 __ call(ic, mode); |
9401 // The call must be followed by: | 9401 // The call must be followed by: |
9402 // - a test eax instruction to indicate that the inobject property | 9402 // - a test eax instruction to indicate that the inobject property |
9403 // case was inlined. | 9403 // case was inlined. |
9404 // - a mov ecx or mov edx instruction to indicate that the | 9404 // - a mov ecx or mov edx instruction to indicate that the |
9405 // contextual property load was inlined. | 9405 // contextual property load was inlined. |
9406 // | 9406 // |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9467 } else { | 9467 } else { |
9468 __ xchg(edx, eax); | 9468 __ xchg(edx, eax); |
9469 } | 9469 } |
9470 // Calculate the delta from the IC call instruction to the map check | 9470 // Calculate the delta from the IC call instruction to the map check |
9471 // cmp instruction in the inlined version. This delta is stored in | 9471 // cmp instruction in the inlined version. This delta is stored in |
9472 // a test(eax, delta) instruction after the call so that we can find | 9472 // a test(eax, delta) instruction after the call so that we can find |
9473 // it in the IC initialization code and patch the cmp instruction. | 9473 // it in the IC initialization code and patch the cmp instruction. |
9474 // This means that we cannot allow test instructions after calls to | 9474 // This means that we cannot allow test instructions after calls to |
9475 // KeyedLoadIC stubs in other places. | 9475 // KeyedLoadIC stubs in other places. |
9476 Handle<Code> ic(masm()->isolate()->builtins()->builtin( | 9476 Handle<Code> ic(masm()->isolate()->builtins()->builtin( |
9477 Builtins::KeyedLoadIC_Initialize)); | 9477 Builtins::kKeyedLoadIC_Initialize)); |
9478 __ call(ic, RelocInfo::CODE_TARGET); | 9478 __ call(ic, RelocInfo::CODE_TARGET); |
9479 // The delta from the start of the map-compare instruction to the | 9479 // The delta from the start of the map-compare instruction to the |
9480 // test instruction. We use masm_-> directly here instead of the __ | 9480 // test instruction. We use masm_-> directly here instead of the __ |
9481 // macro because the macro sometimes uses macro expansion to turn | 9481 // macro because the macro sometimes uses macro expansion to turn |
9482 // into something that can't return a value. This is encountered | 9482 // into something that can't return a value. This is encountered |
9483 // when doing generated code coverage tests. | 9483 // when doing generated code coverage tests. |
9484 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 9484 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
9485 // Here we use masm_-> instead of the __ macro because this is the | 9485 // Here we use masm_-> instead of the __ macro because this is the |
9486 // instruction that gets patched and coverage code gets in the way. | 9486 // instruction that gets patched and coverage code gets in the way. |
9487 masm_->test(eax, Immediate(-delta_to_patch_site)); | 9487 masm_->test(eax, Immediate(-delta_to_patch_site)); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9571 } | 9571 } |
9572 } else { // Key is not in edx or ecx. | 9572 } else { // Key is not in edx or ecx. |
9573 if (!receiver_.is(edx)) { | 9573 if (!receiver_.is(edx)) { |
9574 __ mov(edx, receiver_); | 9574 __ mov(edx, receiver_); |
9575 } | 9575 } |
9576 __ mov(ecx, key_); | 9576 __ mov(ecx, key_); |
9577 } | 9577 } |
9578 | 9578 |
9579 // Call the IC stub. | 9579 // Call the IC stub. |
9580 Handle<Code> ic(masm()->isolate()->builtins()->builtin( | 9580 Handle<Code> ic(masm()->isolate()->builtins()->builtin( |
9581 (strict_mode_ == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict | 9581 (strict_mode_ == kStrictMode) ? Builtins::kKeyedStoreIC_Initialize_Strict |
9582 : Builtins::KeyedStoreIC_Initialize)); | 9582 : Builtins::kKeyedStoreIC_Initialize)); |
9583 __ call(ic, RelocInfo::CODE_TARGET); | 9583 __ call(ic, RelocInfo::CODE_TARGET); |
9584 // The delta from the start of the map-compare instruction to the | 9584 // The delta from the start of the map-compare instruction to the |
9585 // test instruction. We use masm_-> directly here instead of the | 9585 // test instruction. We use masm_-> directly here instead of the |
9586 // __ macro because the macro sometimes uses macro expansion to turn | 9586 // __ macro because the macro sometimes uses macro expansion to turn |
9587 // into something that can't return a value. This is encountered | 9587 // into something that can't return a value. This is encountered |
9588 // when doing generated code coverage tests. | 9588 // when doing generated code coverage tests. |
9589 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); | 9589 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); |
9590 // Here we use masm_-> instead of the __ macro because this is the | 9590 // Here we use masm_-> instead of the __ macro because this is the |
9591 // instruction that gets patched and coverage code gets in the way. | 9591 // instruction that gets patched and coverage code gets in the way. |
9592 masm_->test(eax, Immediate(-delta_to_patch_site)); | 9592 masm_->test(eax, Immediate(-delta_to_patch_site)); |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10378 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); | 10378 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); |
10379 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); | 10379 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); |
10380 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); | 10380 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); |
10381 } | 10381 } |
10382 | 10382 |
10383 #undef __ | 10383 #undef __ |
10384 | 10384 |
10385 } } // namespace v8::internal | 10385 } } // namespace v8::internal |
10386 | 10386 |
10387 #endif // V8_TARGET_ARCH_IA32 | 10387 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |