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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 months 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/x64/ic-x64.cc ('k') | src/x64/lithium-x64.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 458
459 // Signal that we don't inline smi code before these stubs in the 459 // Signal that we don't inline smi code before these stubs in the
460 // optimizing code generator. 460 // optimizing code generator.
461 if (code->kind() == Code::TYPE_RECORDING_BINARY_OP_IC || 461 if (code->kind() == Code::TYPE_RECORDING_BINARY_OP_IC ||
462 code->kind() == Code::COMPARE_IC) { 462 code->kind() == Code::COMPARE_IC) {
463 __ nop(); 463 __ nop();
464 } 464 }
465 } 465 }
466 466
467 467
468 void LCodeGen::CallRuntime(Runtime::Function* function, 468 void LCodeGen::CallRuntime(const Runtime::Function* function,
469 int num_arguments, 469 int num_arguments,
470 LInstruction* instr) { 470 LInstruction* instr) {
471 ASSERT(instr != NULL); 471 ASSERT(instr != NULL);
472 ASSERT(instr->HasPointerMap()); 472 ASSERT(instr->HasPointerMap());
473 LPointerMap* pointers = instr->pointer_map(); 473 LPointerMap* pointers = instr->pointer_map();
474 RecordPosition(pointers->position()); 474 RecordPosition(pointers->position());
475 475
476 __ CallRuntime(function, num_arguments); 476 __ CallRuntime(function, num_arguments);
477 RegisterLazyDeoptimization(instr); 477 RegisterLazyDeoptimization(instr);
478 } 478 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 __ j(cc, &jump_table_.last().label); 546 __ j(cc, &jump_table_.last().label);
547 } 547 }
548 } 548 }
549 549
550 550
551 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { 551 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
552 int length = deoptimizations_.length(); 552 int length = deoptimizations_.length();
553 if (length == 0) return; 553 if (length == 0) return;
554 ASSERT(FLAG_deopt); 554 ASSERT(FLAG_deopt);
555 Handle<DeoptimizationInputData> data = 555 Handle<DeoptimizationInputData> data =
556 Factory::NewDeoptimizationInputData(length, TENURED); 556 factory()->NewDeoptimizationInputData(length, TENURED);
557 557
558 Handle<ByteArray> translations = translations_.CreateByteArray(); 558 Handle<ByteArray> translations = translations_.CreateByteArray();
559 data->SetTranslationByteArray(*translations); 559 data->SetTranslationByteArray(*translations);
560 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_)); 560 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_));
561 561
562 Handle<FixedArray> literals = 562 Handle<FixedArray> literals =
563 Factory::NewFixedArray(deoptimization_literals_.length(), TENURED); 563 factory()->NewFixedArray(deoptimization_literals_.length(), TENURED);
564 for (int i = 0; i < deoptimization_literals_.length(); i++) { 564 for (int i = 0; i < deoptimization_literals_.length(); i++) {
565 literals->set(i, *deoptimization_literals_[i]); 565 literals->set(i, *deoptimization_literals_[i]);
566 } 566 }
567 data->SetLiteralArray(*literals); 567 data->SetLiteralArray(*literals);
568 568
569 data->SetOsrAstId(Smi::FromInt(info_->osr_ast_id())); 569 data->SetOsrAstId(Smi::FromInt(info_->osr_ast_id()));
570 data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_)); 570 data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_));
571 571
572 // Populate the deoptimization entries. 572 // Populate the deoptimization entries.
573 for (int i = 0; i < length; i++) { 573 for (int i = 0; i < length; i++) {
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 __ JumpIfSmi(object, &false_result); 1903 __ JumpIfSmi(object, &false_result);
1904 1904
1905 // This is the inlined call site instanceof cache. The two occurences of the 1905 // This is the inlined call site instanceof cache. The two occurences of the
1906 // hole value will be patched to the last map/result pair generated by the 1906 // hole value will be patched to the last map/result pair generated by the
1907 // instanceof stub. 1907 // instanceof stub.
1908 NearLabel cache_miss; 1908 NearLabel cache_miss;
1909 // Use a temp register to avoid memory operands with variable lengths. 1909 // Use a temp register to avoid memory operands with variable lengths.
1910 Register map = ToRegister(instr->TempAt(0)); 1910 Register map = ToRegister(instr->TempAt(0));
1911 __ movq(map, FieldOperand(object, HeapObject::kMapOffset)); 1911 __ movq(map, FieldOperand(object, HeapObject::kMapOffset));
1912 __ bind(deferred->map_check()); // Label for calculating code patching. 1912 __ bind(deferred->map_check()); // Label for calculating code patching.
1913 __ Move(kScratchRegister, Factory::the_hole_value()); 1913 __ Move(kScratchRegister, factory()->the_hole_value());
1914 __ cmpq(map, kScratchRegister); // Patched to cached map. 1914 __ cmpq(map, kScratchRegister); // Patched to cached map.
1915 __ j(not_equal, &cache_miss); 1915 __ j(not_equal, &cache_miss);
1916 // Patched to load either true or false. 1916 // Patched to load either true or false.
1917 __ LoadRoot(ToRegister(instr->result()), Heap::kTheHoleValueRootIndex); 1917 __ LoadRoot(ToRegister(instr->result()), Heap::kTheHoleValueRootIndex);
1918 #ifdef DEBUG 1918 #ifdef DEBUG
1919 // Check that the code size between patch label and patch sites is invariant. 1919 // Check that the code size between patch label and patch sites is invariant.
1920 Label end_of_patched_code; 1920 Label end_of_patched_code;
1921 __ bind(&end_of_patched_code); 1921 __ bind(&end_of_patched_code);
1922 ASSERT(true); 1922 ASSERT(true);
1923 #endif 1923 #endif
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 __ movq(result, FieldOperand(result, instr->hydrogen()->offset())); 2092 __ movq(result, FieldOperand(result, instr->hydrogen()->offset()));
2093 } 2093 }
2094 } 2094 }
2095 2095
2096 2096
2097 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 2097 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2098 ASSERT(ToRegister(instr->object()).is(rax)); 2098 ASSERT(ToRegister(instr->object()).is(rax));
2099 ASSERT(ToRegister(instr->result()).is(rax)); 2099 ASSERT(ToRegister(instr->result()).is(rax));
2100 2100
2101 __ Move(rcx, instr->name()); 2101 __ Move(rcx, instr->name());
2102 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); 2102 Handle<Code> ic(isolate()->builtins()->builtin(Builtins::LoadIC_Initialize));
2103 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2103 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2104 } 2104 }
2105 2105
2106 2106
2107 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { 2107 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
2108 Register function = ToRegister(instr->function()); 2108 Register function = ToRegister(instr->function());
2109 Register result = ToRegister(instr->result()); 2109 Register result = ToRegister(instr->result());
2110 2110
2111 // Check that the function really is a function. 2111 // Check that the function really is a function.
2112 __ CmpObjectType(function, JS_FUNCTION_TYPE, result); 2112 __ CmpObjectType(function, JS_FUNCTION_TYPE, result);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 2218
2219 // Load the result. 2219 // Load the result.
2220 __ movzxbq(result, Operand(external_elements, key, times_1, 0)); 2220 __ movzxbq(result, Operand(external_elements, key, times_1, 0));
2221 } 2221 }
2222 2222
2223 2223
2224 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { 2224 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2225 ASSERT(ToRegister(instr->object()).is(rdx)); 2225 ASSERT(ToRegister(instr->object()).is(rdx));
2226 ASSERT(ToRegister(instr->key()).is(rax)); 2226 ASSERT(ToRegister(instr->key()).is(rax));
2227 2227
2228 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 2228 Handle<Code> ic(isolate()->builtins()->builtin(
2229 Builtins::KeyedLoadIC_Initialize));
2229 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2230 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2230 } 2231 }
2231 2232
2232 2233
2233 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { 2234 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
2234 Register result = ToRegister(instr->result()); 2235 Register result = ToRegister(instr->result());
2235 2236
2236 // Check for arguments adapter frame. 2237 // Check for arguments adapter frame.
2237 NearLabel done, adapted; 2238 NearLabel done, adapted;
2238 __ movq(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 2239 __ movq(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2717 UNREACHABLE(); 2718 UNREACHABLE();
2718 } 2719 }
2719 } 2720 }
2720 2721
2721 2722
2722 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { 2723 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
2723 ASSERT(ToRegister(instr->key()).is(rcx)); 2724 ASSERT(ToRegister(instr->key()).is(rcx));
2724 ASSERT(ToRegister(instr->result()).is(rax)); 2725 ASSERT(ToRegister(instr->result()).is(rax));
2725 2726
2726 int arity = instr->arity(); 2727 int arity = instr->arity();
2727 Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arity, NOT_IN_LOOP); 2728 Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize(
2729 arity, NOT_IN_LOOP);
2728 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2730 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2729 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2731 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2730 } 2732 }
2731 2733
2732 2734
2733 void LCodeGen::DoCallNamed(LCallNamed* instr) { 2735 void LCodeGen::DoCallNamed(LCallNamed* instr) {
2734 ASSERT(ToRegister(instr->result()).is(rax)); 2736 ASSERT(ToRegister(instr->result()).is(rax));
2735 2737
2736 int arity = instr->arity(); 2738 int arity = instr->arity();
2737 Handle<Code> ic = StubCache::ComputeCallInitialize(arity, NOT_IN_LOOP); 2739 Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(
2740 arity, NOT_IN_LOOP);
2738 __ Move(rcx, instr->name()); 2741 __ Move(rcx, instr->name());
2739 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2742 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2740 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2743 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2741 } 2744 }
2742 2745
2743 2746
2744 void LCodeGen::DoCallFunction(LCallFunction* instr) { 2747 void LCodeGen::DoCallFunction(LCallFunction* instr) {
2745 ASSERT(ToRegister(instr->result()).is(rax)); 2748 ASSERT(ToRegister(instr->result()).is(rax));
2746 2749
2747 int arity = instr->arity(); 2750 int arity = instr->arity();
2748 CallFunctionStub stub(arity, NOT_IN_LOOP, RECEIVER_MIGHT_BE_VALUE); 2751 CallFunctionStub stub(arity, NOT_IN_LOOP, RECEIVER_MIGHT_BE_VALUE);
2749 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 2752 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2750 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2753 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2751 __ Drop(1); 2754 __ Drop(1);
2752 } 2755 }
2753 2756
2754 2757
2755 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { 2758 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
2756 ASSERT(ToRegister(instr->result()).is(rax)); 2759 ASSERT(ToRegister(instr->result()).is(rax));
2757 int arity = instr->arity(); 2760 int arity = instr->arity();
2758 Handle<Code> ic = StubCache::ComputeCallInitialize(arity, NOT_IN_LOOP); 2761 Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(
2762 arity, NOT_IN_LOOP);
2759 __ Move(rcx, instr->name()); 2763 __ Move(rcx, instr->name());
2760 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); 2764 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
2761 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2765 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2762 } 2766 }
2763 2767
2764 2768
2765 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { 2769 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
2766 ASSERT(ToRegister(instr->result()).is(rax)); 2770 ASSERT(ToRegister(instr->result()).is(rax));
2767 __ Move(rdi, instr->target()); 2771 __ Move(rdi, instr->target());
2768 CallKnownFunction(instr->target(), instr->arity(), instr); 2772 CallKnownFunction(instr->target(), instr->arity(), instr);
2769 } 2773 }
2770 2774
2771 2775
2772 void LCodeGen::DoCallNew(LCallNew* instr) { 2776 void LCodeGen::DoCallNew(LCallNew* instr) {
2773 ASSERT(ToRegister(instr->InputAt(0)).is(rdi)); 2777 ASSERT(ToRegister(instr->InputAt(0)).is(rdi));
2774 ASSERT(ToRegister(instr->result()).is(rax)); 2778 ASSERT(ToRegister(instr->result()).is(rax));
2775 2779
2776 Handle<Code> builtin(Builtins::builtin(Builtins::JSConstructCall)); 2780 Handle<Code> builtin(isolate()->builtins()->builtin(
2781 Builtins::JSConstructCall));
2777 __ Set(rax, instr->arity()); 2782 __ Set(rax, instr->arity());
2778 CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr); 2783 CallCode(builtin, RelocInfo::CONSTRUCT_CALL, instr);
2779 } 2784 }
2780 2785
2781 2786
2782 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { 2787 void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
2783 CallRuntime(instr->function(), instr->arity(), instr); 2788 CallRuntime(instr->function(), instr->arity(), instr);
2784 } 2789 }
2785 2790
2786 2791
(...skipping 25 matching lines...) Expand all
2812 } 2817 }
2813 } 2818 }
2814 } 2819 }
2815 2820
2816 2821
2817 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { 2822 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
2818 ASSERT(ToRegister(instr->object()).is(rdx)); 2823 ASSERT(ToRegister(instr->object()).is(rdx));
2819 ASSERT(ToRegister(instr->value()).is(rax)); 2824 ASSERT(ToRegister(instr->value()).is(rax));
2820 2825
2821 __ Move(rcx, instr->hydrogen()->name()); 2826 __ Move(rcx, instr->hydrogen()->name());
2822 Handle<Code> ic(Builtins::builtin( 2827 Handle<Code> ic(isolate()->builtins()->builtin(
2823 info_->is_strict() ? Builtins::StoreIC_Initialize_Strict 2828 info_->is_strict() ? Builtins::StoreIC_Initialize_Strict
2824 : Builtins::StoreIC_Initialize)); 2829 : Builtins::StoreIC_Initialize));
2825 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2830 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2826 } 2831 }
2827 2832
2828 2833
2829 void LCodeGen::DoStorePixelArrayElement(LStorePixelArrayElement* instr) { 2834 void LCodeGen::DoStorePixelArrayElement(LStorePixelArrayElement* instr) {
2830 Register external_pointer = ToRegister(instr->external_pointer()); 2835 Register external_pointer = ToRegister(instr->external_pointer());
2831 Register key = ToRegister(instr->key()); 2836 Register key = ToRegister(instr->key());
2832 Register value = ToRegister(instr->value()); 2837 Register value = ToRegister(instr->value());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2883 __ RecordWrite(elements, key, value); 2888 __ RecordWrite(elements, key, value);
2884 } 2889 }
2885 } 2890 }
2886 2891
2887 2892
2888 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 2893 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
2889 ASSERT(ToRegister(instr->object()).is(rdx)); 2894 ASSERT(ToRegister(instr->object()).is(rdx));
2890 ASSERT(ToRegister(instr->key()).is(rcx)); 2895 ASSERT(ToRegister(instr->key()).is(rcx));
2891 ASSERT(ToRegister(instr->value()).is(rax)); 2896 ASSERT(ToRegister(instr->value()).is(rax));
2892 2897
2893 Handle<Code> ic(Builtins::builtin( 2898 Handle<Code> ic(isolate()->builtins()->builtin(
2894 info_->is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict 2899 info_->is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict
2895 : Builtins::KeyedStoreIC_Initialize)); 2900 : Builtins::KeyedStoreIC_Initialize));
2896 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2901 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2897 } 2902 }
2898 2903
2899 2904
2900 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { 2905 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
2901 class DeferredStringCharCodeAt: public LDeferredCode { 2906 class DeferredStringCharCodeAt: public LDeferredCode {
2902 public: 2907 public:
2903 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) 2908 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
3392 LOperand* input = instr->InputAt(0); 3397 LOperand* input = instr->InputAt(0);
3393 ASSERT(input->IsRegister()); 3398 ASSERT(input->IsRegister());
3394 Register reg = ToRegister(input); 3399 Register reg = ToRegister(input);
3395 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), 3400 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset),
3396 instr->hydrogen()->map()); 3401 instr->hydrogen()->map());
3397 DeoptimizeIf(not_equal, instr->environment()); 3402 DeoptimizeIf(not_equal, instr->environment());
3398 } 3403 }
3399 3404
3400 3405
3401 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) { 3406 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) {
3402 if (Heap::InNewSpace(*object)) { 3407 if (heap()->InNewSpace(*object)) {
3403 Handle<JSGlobalPropertyCell> cell = 3408 Handle<JSGlobalPropertyCell> cell =
3404 Factory::NewJSGlobalPropertyCell(object); 3409 factory()->NewJSGlobalPropertyCell(object);
3405 __ movq(result, cell, RelocInfo::GLOBAL_PROPERTY_CELL); 3410 __ movq(result, cell, RelocInfo::GLOBAL_PROPERTY_CELL);
3406 __ movq(result, Operand(result, 0)); 3411 __ movq(result, Operand(result, 0));
3407 } else { 3412 } else {
3408 __ Move(result, object); 3413 __ Move(result, object);
3409 } 3414 }
3410 } 3415 }
3411 3416
3412 3417
3413 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { 3418 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
3414 Register reg = ToRegister(instr->TempAt(0)); 3419 Register reg = ToRegister(instr->TempAt(0));
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 3628
3624 EmitBranch(true_block, false_block, final_branch_condition); 3629 EmitBranch(true_block, false_block, final_branch_condition);
3625 } 3630 }
3626 3631
3627 3632
3628 Condition LCodeGen::EmitTypeofIs(Label* true_label, 3633 Condition LCodeGen::EmitTypeofIs(Label* true_label,
3629 Label* false_label, 3634 Label* false_label,
3630 Register input, 3635 Register input,
3631 Handle<String> type_name) { 3636 Handle<String> type_name) {
3632 Condition final_branch_condition = no_condition; 3637 Condition final_branch_condition = no_condition;
3633 if (type_name->Equals(Heap::number_symbol())) { 3638 if (type_name->Equals(heap()->number_symbol())) {
3634 __ JumpIfSmi(input, true_label); 3639 __ JumpIfSmi(input, true_label);
3635 __ CompareRoot(FieldOperand(input, HeapObject::kMapOffset), 3640 __ CompareRoot(FieldOperand(input, HeapObject::kMapOffset),
3636 Heap::kHeapNumberMapRootIndex); 3641 Heap::kHeapNumberMapRootIndex);
3637 3642
3638 final_branch_condition = equal; 3643 final_branch_condition = equal;
3639 3644
3640 } else if (type_name->Equals(Heap::string_symbol())) { 3645 } else if (type_name->Equals(heap()->string_symbol())) {
3641 __ JumpIfSmi(input, false_label); 3646 __ JumpIfSmi(input, false_label);
3642 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); 3647 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input);
3643 __ j(above_equal, false_label); 3648 __ j(above_equal, false_label);
3644 __ testb(FieldOperand(input, Map::kBitFieldOffset), 3649 __ testb(FieldOperand(input, Map::kBitFieldOffset),
3645 Immediate(1 << Map::kIsUndetectable)); 3650 Immediate(1 << Map::kIsUndetectable));
3646 final_branch_condition = zero; 3651 final_branch_condition = zero;
3647 3652
3648 } else if (type_name->Equals(Heap::boolean_symbol())) { 3653 } else if (type_name->Equals(heap()->boolean_symbol())) {
3649 __ CompareRoot(input, Heap::kTrueValueRootIndex); 3654 __ CompareRoot(input, Heap::kTrueValueRootIndex);
3650 __ j(equal, true_label); 3655 __ j(equal, true_label);
3651 __ CompareRoot(input, Heap::kFalseValueRootIndex); 3656 __ CompareRoot(input, Heap::kFalseValueRootIndex);
3652 final_branch_condition = equal; 3657 final_branch_condition = equal;
3653 3658
3654 } else if (type_name->Equals(Heap::undefined_symbol())) { 3659 } else if (type_name->Equals(heap()->undefined_symbol())) {
3655 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); 3660 __ CompareRoot(input, Heap::kUndefinedValueRootIndex);
3656 __ j(equal, true_label); 3661 __ j(equal, true_label);
3657 __ JumpIfSmi(input, false_label); 3662 __ JumpIfSmi(input, false_label);
3658 // Check for undetectable objects => true. 3663 // Check for undetectable objects => true.
3659 __ movq(input, FieldOperand(input, HeapObject::kMapOffset)); 3664 __ movq(input, FieldOperand(input, HeapObject::kMapOffset));
3660 __ testb(FieldOperand(input, Map::kBitFieldOffset), 3665 __ testb(FieldOperand(input, Map::kBitFieldOffset),
3661 Immediate(1 << Map::kIsUndetectable)); 3666 Immediate(1 << Map::kIsUndetectable));
3662 final_branch_condition = not_zero; 3667 final_branch_condition = not_zero;
3663 3668
3664 } else if (type_name->Equals(Heap::function_symbol())) { 3669 } else if (type_name->Equals(heap()->function_symbol())) {
3665 __ JumpIfSmi(input, false_label); 3670 __ JumpIfSmi(input, false_label);
3666 __ CmpObjectType(input, FIRST_FUNCTION_CLASS_TYPE, input); 3671 __ CmpObjectType(input, FIRST_FUNCTION_CLASS_TYPE, input);
3667 final_branch_condition = above_equal; 3672 final_branch_condition = above_equal;
3668 3673
3669 } else if (type_name->Equals(Heap::object_symbol())) { 3674 } else if (type_name->Equals(heap()->object_symbol())) {
3670 __ JumpIfSmi(input, false_label); 3675 __ JumpIfSmi(input, false_label);
3671 __ CompareRoot(input, Heap::kNullValueRootIndex); 3676 __ CompareRoot(input, Heap::kNullValueRootIndex);
3672 __ j(equal, true_label); 3677 __ j(equal, true_label);
3673 __ CmpObjectType(input, FIRST_JS_OBJECT_TYPE, input); 3678 __ CmpObjectType(input, FIRST_JS_OBJECT_TYPE, input);
3674 __ j(below, false_label); 3679 __ j(below, false_label);
3675 __ CmpInstanceType(input, FIRST_FUNCTION_CLASS_TYPE); 3680 __ CmpInstanceType(input, FIRST_FUNCTION_CLASS_TYPE);
3676 __ j(above_equal, false_label); 3681 __ j(above_equal, false_label);
3677 // Check for undetectable objects => false. 3682 // Check for undetectable objects => false.
3678 __ testb(FieldOperand(input, Map::kBitFieldOffset), 3683 __ testb(FieldOperand(input, Map::kBitFieldOffset),
3679 Immediate(1 << Map::kIsUndetectable)); 3684 Immediate(1 << Map::kIsUndetectable));
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
3807 RegisterEnvironmentForDeoptimization(environment); 3812 RegisterEnvironmentForDeoptimization(environment);
3808 ASSERT(osr_pc_offset_ == -1); 3813 ASSERT(osr_pc_offset_ == -1);
3809 osr_pc_offset_ = masm()->pc_offset(); 3814 osr_pc_offset_ = masm()->pc_offset();
3810 } 3815 }
3811 3816
3812 #undef __ 3817 #undef __
3813 3818
3814 } } // namespace v8::internal 3819 } } // namespace v8::internal
3815 3820
3816 #endif // V8_TARGET_ARCH_X64 3821 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/ic-x64.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698