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

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

Issue 11498006: Revert 13157, 13145 and 13140: Crankshaft code stubs. (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 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor(
45 Isolate* isolate,
46 CodeStubInterfaceDescriptor* descriptor) {
47 static Register registers[] = { edx, ecx };
48 descriptor->register_param_count_ = 2;
49 descriptor->register_params_ = registers;
50 descriptor->deoptimization_handler_ =
51 isolate->builtins()->KeyedLoadIC_Miss();
52 }
53
54
55 #define __ ACCESS_MASM(masm) 43 #define __ ACCESS_MASM(masm)
56 44
57 void ToNumberStub::Generate(MacroAssembler* masm) { 45 void ToNumberStub::Generate(MacroAssembler* masm) {
58 // The ToNumber stub takes one argument in eax. 46 // The ToNumber stub takes one argument in eax.
59 Label check_heap_number, call_builtin; 47 Label check_heap_number, call_builtin;
60 __ JumpIfNotSmi(eax, &check_heap_number, Label::kNear); 48 __ JumpIfNotSmi(eax, &check_heap_number, Label::kNear);
61 __ ret(0); 49 __ ret(0);
62 50
63 __ bind(&check_heap_number); 51 __ bind(&check_heap_number);
64 __ 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
2431 __ cmp(ebx, Immediate(factory->heap_number_map())); 2419 __ cmp(ebx, Immediate(factory->heap_number_map()));
2432 __ j(not_equal, &runtime_call); 2420 __ j(not_equal, &runtime_call);
2433 // 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
2434 // low and high words into ebx, edx. 2422 // low and high words into ebx, edx.
2435 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset)); 2423 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
2436 __ mov(edx, FieldOperand(eax, HeapNumber::kExponentOffset)); 2424 __ mov(edx, FieldOperand(eax, HeapNumber::kExponentOffset));
2437 __ mov(ebx, FieldOperand(eax, HeapNumber::kMantissaOffset)); 2425 __ mov(ebx, FieldOperand(eax, HeapNumber::kMantissaOffset));
2438 2426
2439 __ bind(&loaded); 2427 __ bind(&loaded);
2440 } else { // UNTAGGED. 2428 } else { // UNTAGGED.
2441 CpuFeatures::Scope scope(SSE2);
2442 if (CpuFeatures::IsSupported(SSE4_1)) { 2429 if (CpuFeatures::IsSupported(SSE4_1)) {
2443 CpuFeatures::Scope sse4_scope(SSE4_1); 2430 CpuFeatures::Scope sse4_scope(SSE4_1);
2444 __ pextrd(edx, xmm1, 0x1); // copy xmm1[63..32] to edx. 2431 __ pextrd(edx, xmm1, 0x1); // copy xmm1[63..32] to edx.
2445 } else { 2432 } else {
2446 __ pshufd(xmm0, xmm1, 0x1); 2433 __ pshufd(xmm0, xmm1, 0x1);
2447 __ movd(edx, xmm0); 2434 __ movd(edx, xmm0);
2448 } 2435 }
2449 __ movd(ebx, xmm1); 2436 __ movd(ebx, xmm1);
2450 } 2437 }
2451 2438
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 __ cmp(edx, Operand(ecx, kIntSize)); 2491 __ cmp(edx, Operand(ecx, kIntSize));
2505 __ j(not_equal, &cache_miss, Label::kNear); 2492 __ j(not_equal, &cache_miss, Label::kNear);
2506 // Cache hit! 2493 // Cache hit!
2507 Counters* counters = masm->isolate()->counters(); 2494 Counters* counters = masm->isolate()->counters();
2508 __ IncrementCounter(counters->transcendental_cache_hit(), 1); 2495 __ IncrementCounter(counters->transcendental_cache_hit(), 1);
2509 __ mov(eax, Operand(ecx, 2 * kIntSize)); 2496 __ mov(eax, Operand(ecx, 2 * kIntSize));
2510 if (tagged) { 2497 if (tagged) {
2511 __ fstp(0); 2498 __ fstp(0);
2512 __ ret(kPointerSize); 2499 __ ret(kPointerSize);
2513 } else { // UNTAGGED. 2500 } else { // UNTAGGED.
2514 CpuFeatures::Scope scope(SSE2);
2515 __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset)); 2501 __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset));
2516 __ Ret(); 2502 __ Ret();
2517 } 2503 }
2518 2504
2519 __ bind(&cache_miss); 2505 __ bind(&cache_miss);
2520 __ IncrementCounter(counters->transcendental_cache_miss(), 1); 2506 __ IncrementCounter(counters->transcendental_cache_miss(), 1);
2521 // Update cache with new value. 2507 // Update cache with new value.
2522 // We are short on registers, so use no_reg as scratch. 2508 // We are short on registers, so use no_reg as scratch.
2523 // This gives slightly larger code. 2509 // This gives slightly larger code.
2524 if (tagged) { 2510 if (tagged) {
2525 __ AllocateHeapNumber(eax, edi, no_reg, &runtime_call_clear_stack); 2511 __ AllocateHeapNumber(eax, edi, no_reg, &runtime_call_clear_stack);
2526 } else { // UNTAGGED. 2512 } else { // UNTAGGED.
2527 CpuFeatures::Scope scope(SSE2);
2528 __ AllocateHeapNumber(eax, edi, no_reg, &skip_cache); 2513 __ AllocateHeapNumber(eax, edi, no_reg, &skip_cache);
2529 __ sub(esp, Immediate(kDoubleSize)); 2514 __ sub(esp, Immediate(kDoubleSize));
2530 __ movdbl(Operand(esp, 0), xmm1); 2515 __ movdbl(Operand(esp, 0), xmm1);
2531 __ fld_d(Operand(esp, 0)); 2516 __ fld_d(Operand(esp, 0));
2532 __ add(esp, Immediate(kDoubleSize)); 2517 __ add(esp, Immediate(kDoubleSize));
2533 } 2518 }
2534 GenerateOperation(masm, type_); 2519 GenerateOperation(masm, type_);
2535 __ mov(Operand(ecx, 0), ebx); 2520 __ mov(Operand(ecx, 0), ebx);
2536 __ mov(Operand(ecx, kIntSize), edx); 2521 __ mov(Operand(ecx, kIntSize), edx);
2537 __ mov(Operand(ecx, 2 * kIntSize), eax); 2522 __ mov(Operand(ecx, 2 * kIntSize), eax);
2538 __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset)); 2523 __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset));
2539 if (tagged) { 2524 if (tagged) {
2540 __ ret(kPointerSize); 2525 __ ret(kPointerSize);
2541 } else { // UNTAGGED. 2526 } else { // UNTAGGED.
2542 CpuFeatures::Scope scope(SSE2);
2543 __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset)); 2527 __ movdbl(xmm1, FieldOperand(eax, HeapNumber::kValueOffset));
2544 __ Ret(); 2528 __ Ret();
2545 2529
2546 // Skip cache and return answer directly, only in untagged case. 2530 // Skip cache and return answer directly, only in untagged case.
2547 __ bind(&skip_cache); 2531 __ bind(&skip_cache);
2548 __ sub(esp, Immediate(kDoubleSize)); 2532 __ sub(esp, Immediate(kDoubleSize));
2549 __ movdbl(Operand(esp, 0), xmm1); 2533 __ movdbl(Operand(esp, 0), xmm1);
2550 __ fld_d(Operand(esp, 0)); 2534 __ fld_d(Operand(esp, 0));
2551 GenerateOperation(masm, type_); 2535 GenerateOperation(masm, type_);
2552 __ fstp_d(Operand(esp, 0)); 2536 __ fstp_d(Operand(esp, 0));
(...skipping 12 matching lines...) Expand all
2565 2549
2566 // Call runtime, doing whatever allocation and cleanup is necessary. 2550 // Call runtime, doing whatever allocation and cleanup is necessary.
2567 if (tagged) { 2551 if (tagged) {
2568 __ bind(&runtime_call_clear_stack); 2552 __ bind(&runtime_call_clear_stack);
2569 __ fstp(0); 2553 __ fstp(0);
2570 __ bind(&runtime_call); 2554 __ bind(&runtime_call);
2571 ExternalReference runtime = 2555 ExternalReference runtime =
2572 ExternalReference(RuntimeFunction(), masm->isolate()); 2556 ExternalReference(RuntimeFunction(), masm->isolate());
2573 __ TailCallExternalReference(runtime, 1, 1); 2557 __ TailCallExternalReference(runtime, 1, 1);
2574 } else { // UNTAGGED. 2558 } else { // UNTAGGED.
2575 CpuFeatures::Scope scope(SSE2);
2576 __ bind(&runtime_call_clear_stack); 2559 __ bind(&runtime_call_clear_stack);
2577 __ bind(&runtime_call); 2560 __ bind(&runtime_call);
2578 __ AllocateHeapNumber(eax, edi, no_reg, &skip_cache); 2561 __ AllocateHeapNumber(eax, edi, no_reg, &skip_cache);
2579 __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm1); 2562 __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm1);
2580 { 2563 {
2581 FrameScope scope(masm, StackFrame::INTERNAL); 2564 FrameScope scope(masm, StackFrame::INTERNAL);
2582 __ push(eax); 2565 __ push(eax);
2583 __ CallRuntime(RuntimeFunction(), 1); 2566 __ CallRuntime(RuntimeFunction(), 1);
2584 } 2567 }
2585 __ 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
4818 4801
4819 void CodeStub::GenerateStubsAheadOfTime() { 4802 void CodeStub::GenerateStubsAheadOfTime() {
4820 CEntryStub::GenerateAheadOfTime(); 4803 CEntryStub::GenerateAheadOfTime();
4821 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(); 4804 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime();
4822 // 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.
4823 RecordWriteStub::GenerateFixedRegStubsAheadOfTime(); 4806 RecordWriteStub::GenerateFixedRegStubsAheadOfTime();
4824 } 4807 }
4825 4808
4826 4809
4827 void CodeStub::GenerateFPStubs() { 4810 void CodeStub::GenerateFPStubs() {
4828 if (CpuFeatures::IsSupported(SSE2)) { 4811 CEntryStub save_doubles(1, kSaveFPRegs);
4829 CEntryStub save_doubles(1, kSaveFPRegs); 4812 Handle<Code> code = save_doubles.GetCode();
4830 // Stubs might already be in the snapshot, detect that and don't regenerate, 4813 code->set_is_pregenerated(true);
4831 // which would lead to code stub initialization state being messed up. 4814 code->GetIsolate()->set_fp_stubs_generated(true);
4832 Code* save_doubles_code;
4833 if (!save_doubles.FindCodeInCache(&save_doubles_code, ISOLATE)) {
4834 save_doubles_code = *(save_doubles.GetCode());
4835 }
4836 save_doubles_code->set_is_pregenerated(true);
4837 save_doubles_code->GetIsolate()->set_fp_stubs_generated(true);
4838 }
4839 } 4815 }
4840 4816
4841 4817
4842 void CEntryStub::GenerateAheadOfTime() { 4818 void CEntryStub::GenerateAheadOfTime() {
4843 CEntryStub stub(1, kDontSaveFPRegs); 4819 CEntryStub stub(1, kDontSaveFPRegs);
4844 Handle<Code> code = stub.GetCode(); 4820 Handle<Code> code = stub.GetCode();
4845 code->set_is_pregenerated(true); 4821 code->set_is_pregenerated(true);
4846 } 4822 }
4847 4823
4848 4824
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
7473 // Restore ecx. 7449 // Restore ecx.
7474 __ pop(ecx); 7450 __ pop(ecx);
7475 __ ret(0); 7451 __ ret(0);
7476 } 7452 }
7477 7453
7478 #undef __ 7454 #undef __
7479 7455
7480 } } // namespace v8::internal 7456 } } // namespace v8::internal
7481 7457
7482 #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