Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 11414262: Revert 13105: "Enable stub generation using Hydrogen/Lithium." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 22 matching lines...) Expand all
33 #include "code-stubs.h" 33 #include "code-stubs.h"
34 #include "isolate.h" 34 #include "isolate.h"
35 #include "jsregexp.h" 35 #include "jsregexp.h"
36 #include "regexp-macro-assembler.h" 36 #include "regexp-macro-assembler.h"
37 #include "stub-cache.h" 37 #include "stub-cache.h"
38 #include "codegen.h" 38 #include "codegen.h"
39 39
40 namespace v8 { 40 namespace v8 {
41 namespace internal { 41 namespace internal {
42 42
43
44 CodeStubInterfaceDescriptor*
45 KeyedLoadFastElementStub::GetInterfaceDescriptor(Isolate* isolate) {
46 static CodeStubInterfaceDescriptor* result = NULL;
47 if (result == NULL) {
48 Handle<Code> miss = isolate->builtins()->KeyedLoadIC_Miss();
49 static Register registers[] = { edx, ecx };
50 static CodeStubInterfaceDescriptor info = {
51 2,
52 registers,
53 miss
54 };
55 result = &info;
56 }
57 return result;
58 }
59
60
61 #define __ ACCESS_MASM(masm) 43 #define __ ACCESS_MASM(masm)
62 44
63 void ToNumberStub::Generate(MacroAssembler* masm) { 45 void ToNumberStub::Generate(MacroAssembler* masm) {
64 // The ToNumber stub takes one argument in eax. 46 // The ToNumber stub takes one argument in eax.
65 Label check_heap_number, call_builtin; 47 Label check_heap_number, call_builtin;
66 __ JumpIfNotSmi(eax, &check_heap_number, Label::kNear); 48 __ JumpIfNotSmi(eax, &check_heap_number, Label::kNear);
67 __ ret(0); 49 __ ret(0);
68 50
69 __ bind(&check_heap_number); 51 __ bind(&check_heap_number);
70 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); 52 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
(...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2437 __ cmp(ebx, Immediate(factory->heap_number_map())); 2419 __ cmp(ebx, Immediate(factory->heap_number_map()));
2438 __ j(not_equal, &runtime_call); 2420 __ j(not_equal, &runtime_call);
2439 // Input is a HeapNumber. Push it on the FPU stack and load its 2421 // Input is a HeapNumber. Push it on the FPU stack and load its
2440 // low and high words into ebx, edx. 2422 // low and high words into ebx, edx.
2441 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset)); 2423 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
2442 __ mov(edx, FieldOperand(eax, HeapNumber::kExponentOffset)); 2424 __ mov(edx, FieldOperand(eax, HeapNumber::kExponentOffset));
2443 __ mov(ebx, FieldOperand(eax, HeapNumber::kMantissaOffset)); 2425 __ mov(ebx, FieldOperand(eax, HeapNumber::kMantissaOffset));
2444 2426
2445 __ bind(&loaded); 2427 __ bind(&loaded);
2446 } else { // UNTAGGED. 2428 } else { // UNTAGGED.
2447 CpuFeatures::Scope scope(SSE2);
2448 if (CpuFeatures::IsSupported(SSE4_1)) { 2429 if (CpuFeatures::IsSupported(SSE4_1)) {
2449 CpuFeatures::Scope sse4_scope(SSE4_1); 2430 CpuFeatures::Scope sse4_scope(SSE4_1);
2450 __ pextrd(edx, xmm1, 0x1); // copy xmm1[63..32] to edx. 2431 __ pextrd(edx, xmm1, 0x1); // copy xmm1[63..32] to edx.
2451 } else { 2432 } else {
2452 __ pshufd(xmm0, xmm1, 0x1); 2433 __ pshufd(xmm0, xmm1, 0x1);
2453 __ movd(edx, xmm0); 2434 __ movd(edx, xmm0);
2454 } 2435 }
2455 __ movd(ebx, xmm1); 2436 __ movd(ebx, xmm1);
2456 } 2437 }
2457 2438
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 __ cmp(edx, Operand(ecx, kIntSize)); 2491 __ cmp(edx, Operand(ecx, kIntSize));
2511 __ j(not_equal, &cache_miss, Label::kNear); 2492 __ j(not_equal, &cache_miss, Label::kNear);
2512 // Cache hit! 2493 // Cache hit!
2513 Counters* counters = masm->isolate()->counters(); 2494 Counters* counters = masm->isolate()->counters();
2514 __ IncrementCounter(counters->transcendental_cache_hit(), 1); 2495 __ IncrementCounter(counters->transcendental_cache_hit(), 1);
2515 __ mov(eax, Operand(ecx, 2 * kIntSize)); 2496 __ mov(eax, Operand(ecx, 2 * kIntSize));
2516 if (tagged) { 2497 if (tagged) {
2517 __ fstp(0); 2498 __ fstp(0);
2518 __ ret(kPointerSize); 2499 __ ret(kPointerSize);
2519 } else { // UNTAGGED. 2500 } else { // UNTAGGED.
2520 CpuFeatures::Scope scope(SSE2);
2521 __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset)); 2501 __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset));
2522 __ Ret(); 2502 __ Ret();
2523 } 2503 }
2524 2504
2525 __ bind(&cache_miss); 2505 __ bind(&cache_miss);
2526 __ IncrementCounter(counters->transcendental_cache_miss(), 1); 2506 __ IncrementCounter(counters->transcendental_cache_miss(), 1);
2527 // Update cache with new value. 2507 // Update cache with new value.
2528 // We are short on registers, so use no_reg as scratch. 2508 // We are short on registers, so use no_reg as scratch.
2529 // This gives slightly larger code. 2509 // This gives slightly larger code.
2530 if (tagged) { 2510 if (tagged) {
2531 __ AllocateHeapNumber(eax, edi, no_reg, &runtime_call_clear_stack); 2511 __ AllocateHeapNumber(eax, edi, no_reg, &runtime_call_clear_stack);
2532 } else { // UNTAGGED. 2512 } else { // UNTAGGED.
2533 CpuFeatures::Scope scope(SSE2);
2534 __ AllocateHeapNumber(eax, edi, no_reg, &skip_cache); 2513 __ AllocateHeapNumber(eax, edi, no_reg, &skip_cache);
2535 __ sub(esp, Immediate(kDoubleSize)); 2514 __ sub(esp, Immediate(kDoubleSize));
2536 __ movdbl(Operand(esp, 0), xmm1); 2515 __ movdbl(Operand(esp, 0), xmm1);
2537 __ fld_d(Operand(esp, 0)); 2516 __ fld_d(Operand(esp, 0));
2538 __ add(esp, Immediate(kDoubleSize)); 2517 __ add(esp, Immediate(kDoubleSize));
2539 } 2518 }
2540 GenerateOperation(masm, type_); 2519 GenerateOperation(masm, type_);
2541 __ mov(Operand(ecx, 0), ebx); 2520 __ mov(Operand(ecx, 0), ebx);
2542 __ mov(Operand(ecx, kIntSize), edx); 2521 __ mov(Operand(ecx, kIntSize), edx);
2543 __ mov(Operand(ecx, 2 * kIntSize), eax); 2522 __ mov(Operand(ecx, 2 * kIntSize), eax);
2544 __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset)); 2523 __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset));
2545 if (tagged) { 2524 if (tagged) {
2546 __ ret(kPointerSize); 2525 __ ret(kPointerSize);
2547 } else { // UNTAGGED. 2526 } else { // UNTAGGED.
2548 CpuFeatures::Scope scope(SSE2);
2549 __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset)); 2527 __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset));
2550 __ Ret(); 2528 __ Ret();
2551 2529
2552 // Skip cache and return answer directly, only in untagged case. 2530 // Skip cache and return answer directly, only in untagged case.
2553 __ bind(&skip_cache); 2531 __ bind(&skip_cache);
2554 __ sub(esp, Immediate(kDoubleSize)); 2532 __ sub(esp, Immediate(kDoubleSize));
2555 __ movdbl(Operand(esp, 0), xmm1); 2533 __ movdbl(Operand(esp, 0), xmm1);
2556 __ fld_d(Operand(esp, 0)); 2534 __ fld_d(Operand(esp, 0));
2557 GenerateOperation(masm, type_); 2535 GenerateOperation(masm, type_);
2558 __ fstp_d(Operand(esp, 0)); 2536 __ fstp_d(Operand(esp, 0));
(...skipping 12 matching lines...) Expand all
2571 2549
2572 // Call runtime, doing whatever allocation and cleanup is necessary. 2550 // Call runtime, doing whatever allocation and cleanup is necessary.
2573 if (tagged) { 2551 if (tagged) {
2574 __ bind(&runtime_call_clear_stack); 2552 __ bind(&runtime_call_clear_stack);
2575 __ fstp(0); 2553 __ fstp(0);
2576 __ bind(&runtime_call); 2554 __ bind(&runtime_call);
2577 ExternalReference runtime = 2555 ExternalReference runtime =
2578 ExternalReference(RuntimeFunction(), masm->isolate()); 2556 ExternalReference(RuntimeFunction(), masm->isolate());
2579 __ TailCallExternalReference(runtime, 1, 1); 2557 __ TailCallExternalReference(runtime, 1, 1);
2580 } else { // UNTAGGED. 2558 } else { // UNTAGGED.
2581 CpuFeatures::Scope scope(SSE2);
2582 __ bind(&runtime_call_clear_stack); 2559 __ bind(&runtime_call_clear_stack);
2583 __ bind(&runtime_call); 2560 __ bind(&runtime_call);
2584 __ AllocateHeapNumber(eax, edi, no_reg, &skip_cache); 2561 __ AllocateHeapNumber(eax, edi, no_reg, &skip_cache);
2585 __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm1); 2562 __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm1);
2586 { 2563 {
2587 FrameScope scope(masm, StackFrame::INTERNAL); 2564 FrameScope scope(masm, StackFrame::INTERNAL);
2588 __ push(eax); 2565 __ push(eax);
2589 __ CallRuntime(RuntimeFunction(), 1); 2566 __ CallRuntime(RuntimeFunction(), 1);
2590 } 2567 }
2591 __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset)); 2568 __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset));
(...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after
4824 4801
4825 void CodeStub::GenerateStubsAheadOfTime() { 4802 void CodeStub::GenerateStubsAheadOfTime() {
4826 CEntryStub::GenerateAheadOfTime(); 4803 CEntryStub::GenerateAheadOfTime();
4827 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(); 4804 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime();
4828 // It is important that the store buffer overflow stubs are generated first. 4805 // It is important that the store buffer overflow stubs are generated first.
4829 RecordWriteStub::GenerateFixedRegStubsAheadOfTime(); 4806 RecordWriteStub::GenerateFixedRegStubsAheadOfTime();
4830 } 4807 }
4831 4808
4832 4809
4833 void CodeStub::GenerateFPStubs() { 4810 void CodeStub::GenerateFPStubs() {
4834 if (CpuFeatures::IsSupported(SSE2)) { 4811 CEntryStub save_doubles(1, kSaveFPRegs);
4835 CEntryStub save_doubles(1, kSaveFPRegs); 4812 Handle<Code> code = save_doubles.GetCode();
4836 Handle<Code> code = save_doubles.GetCode(); 4813 code->set_is_pregenerated(true);
4837 code->set_is_pregenerated(true); 4814 code->GetIsolate()->set_fp_stubs_generated(true);
4838 code->GetIsolate()->set_fp_stubs_generated(true);
4839 }
4840 } 4815 }
4841 4816
4842 4817
4843 void CEntryStub::GenerateAheadOfTime() { 4818 void CEntryStub::GenerateAheadOfTime() {
4844 CEntryStub stub(1, kDontSaveFPRegs); 4819 CEntryStub stub(1, kDontSaveFPRegs);
4845 Handle<Code> code = stub.GetCode(); 4820 Handle<Code> code = stub.GetCode();
4846 code->set_is_pregenerated(true); 4821 code->set_is_pregenerated(true);
4847 } 4822 }
4848 4823
4849 4824
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
7474 // Restore ecx. 7449 // Restore ecx.
7475 __ pop(ecx); 7450 __ pop(ecx);
7476 __ ret(0); 7451 __ ret(0);
7477 } 7452 }
7478 7453
7479 #undef __ 7454 #undef __
7480 7455
7481 } } // namespace v8::internal 7456 } } // namespace v8::internal
7482 7457
7483 #endif // V8_TARGET_ARCH_IA32 7458 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698