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

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

Issue 6683022: [Isolates] Merge 7111:7152 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
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/deoptimizer-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 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { 1052 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) {
1053 Register result = ToRegister(instr->result()); 1053 Register result = ToRegister(instr->result());
1054 Register array = ToRegister(instr->InputAt(0)); 1054 Register array = ToRegister(instr->InputAt(0));
1055 __ movq(result, FieldOperand(array, FixedArray::kLengthOffset)); 1055 __ movq(result, FieldOperand(array, FixedArray::kLengthOffset));
1056 } 1056 }
1057 1057
1058 1058
1059 void LCodeGen::DoExternalArrayLength(LExternalArrayLength* instr) { 1059 void LCodeGen::DoExternalArrayLength(LExternalArrayLength* instr) {
1060 Register result = ToRegister(instr->result()); 1060 Register result = ToRegister(instr->result());
1061 Register array = ToRegister(instr->InputAt(0)); 1061 Register array = ToRegister(instr->InputAt(0));
1062 __ movq(result, FieldOperand(array, ExternalPixelArray::kLengthOffset)); 1062 __ movl(result, FieldOperand(array, ExternalPixelArray::kLengthOffset));
1063 } 1063 }
1064 1064
1065 1065
1066 void LCodeGen::DoValueOf(LValueOf* instr) { 1066 void LCodeGen::DoValueOf(LValueOf* instr) {
1067 Register input = ToRegister(instr->InputAt(0)); 1067 Register input = ToRegister(instr->InputAt(0));
1068 Register result = ToRegister(instr->result()); 1068 Register result = ToRegister(instr->result());
1069 ASSERT(input.is(result)); 1069 ASSERT(input.is(result));
1070 NearLabel done; 1070 NearLabel done;
1071 // If the object is a smi return the object. 1071 // If the object is a smi return the object.
1072 __ JumpIfSmi(input, &done); 1072 __ JumpIfSmi(input, &done);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 } else if (r.IsDouble()) { 1203 } else if (r.IsDouble()) {
1204 XMMRegister reg = ToDoubleRegister(instr->InputAt(0)); 1204 XMMRegister reg = ToDoubleRegister(instr->InputAt(0));
1205 __ xorpd(xmm0, xmm0); 1205 __ xorpd(xmm0, xmm0);
1206 __ ucomisd(reg, xmm0); 1206 __ ucomisd(reg, xmm0);
1207 EmitBranch(true_block, false_block, not_equal); 1207 EmitBranch(true_block, false_block, not_equal);
1208 } else { 1208 } else {
1209 ASSERT(r.IsTagged()); 1209 ASSERT(r.IsTagged());
1210 Register reg = ToRegister(instr->InputAt(0)); 1210 Register reg = ToRegister(instr->InputAt(0));
1211 HType type = instr->hydrogen()->type(); 1211 HType type = instr->hydrogen()->type();
1212 if (type.IsBoolean()) { 1212 if (type.IsBoolean()) {
1213 __ Cmp(reg, FACTORY->true_value()); 1213 __ CompareRoot(reg, Heap::kTrueValueRootIndex);
1214 EmitBranch(true_block, false_block, equal); 1214 EmitBranch(true_block, false_block, equal);
1215 } else if (type.IsSmi()) { 1215 } else if (type.IsSmi()) {
1216 __ SmiCompare(reg, Smi::FromInt(0)); 1216 __ SmiCompare(reg, Smi::FromInt(0));
1217 EmitBranch(true_block, false_block, not_equal); 1217 EmitBranch(true_block, false_block, not_equal);
1218 } else { 1218 } else {
1219 Label* true_label = chunk_->GetAssemblyLabel(true_block); 1219 Label* true_label = chunk_->GetAssemblyLabel(true_block);
1220 Label* false_label = chunk_->GetAssemblyLabel(false_block); 1220 Label* false_label = chunk_->GetAssemblyLabel(false_block);
1221 1221
1222 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); 1222 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex);
1223 __ j(equal, false_label); 1223 __ j(equal, false_label);
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 instr->hydrogen()->type().IsSmi()) { 1470 instr->hydrogen()->type().IsSmi()) {
1471 // If the expression is known to untagged or smi, then it's definitely 1471 // If the expression is known to untagged or smi, then it's definitely
1472 // not null, and it can't be a an undetectable object. 1472 // not null, and it can't be a an undetectable object.
1473 // Jump directly to the false block. 1473 // Jump directly to the false block.
1474 EmitGoto(false_block); 1474 EmitGoto(false_block);
1475 return; 1475 return;
1476 } 1476 }
1477 1477
1478 int true_block = chunk_->LookupDestination(instr->true_block_id()); 1478 int true_block = chunk_->LookupDestination(instr->true_block_id());
1479 1479
1480 __ Cmp(reg, FACTORY->null_value()); 1480 __ CompareRoot(reg, Heap::kNullValueRootIndex);
1481 if (instr->is_strict()) { 1481 if (instr->is_strict()) {
1482 EmitBranch(true_block, false_block, equal); 1482 EmitBranch(true_block, false_block, equal);
1483 } else { 1483 } else {
1484 Label* true_label = chunk_->GetAssemblyLabel(true_block); 1484 Label* true_label = chunk_->GetAssemblyLabel(true_block);
1485 Label* false_label = chunk_->GetAssemblyLabel(false_block); 1485 Label* false_label = chunk_->GetAssemblyLabel(false_block);
1486 __ j(equal, true_label); 1486 __ j(equal, true_label);
1487 __ Cmp(reg, FACTORY->undefined_value()); 1487 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex);
1488 __ j(equal, true_label); 1488 __ j(equal, true_label);
1489 __ JumpIfSmi(reg, false_label); 1489 __ JumpIfSmi(reg, false_label);
1490 // Check for undetectable objects by looking in the bit field in 1490 // Check for undetectable objects by looking in the bit field in
1491 // the map. The object has already been smi checked. 1491 // the map. The object has already been smi checked.
1492 Register scratch = ToRegister(instr->TempAt(0)); 1492 Register scratch = ToRegister(instr->TempAt(0));
1493 __ movq(scratch, FieldOperand(reg, HeapObject::kMapOffset)); 1493 __ movq(scratch, FieldOperand(reg, HeapObject::kMapOffset));
1494 __ testb(FieldOperand(scratch, Map::kBitFieldOffset), 1494 __ testb(FieldOperand(scratch, Map::kBitFieldOffset),
1495 Immediate(1 << Map::kIsUndetectable)); 1495 Immediate(1 << Map::kIsUndetectable));
1496 EmitBranch(true_block, false_block, not_zero); 1496 EmitBranch(true_block, false_block, not_zero);
1497 } 1497 }
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 __ bind(&done); 2085 __ bind(&done);
2086 } 2086 }
2087 2087
2088 2088
2089 void LCodeGen::DoLoadElements(LLoadElements* instr) { 2089 void LCodeGen::DoLoadElements(LLoadElements* instr) {
2090 Register result = ToRegister(instr->result()); 2090 Register result = ToRegister(instr->result());
2091 Register input = ToRegister(instr->InputAt(0)); 2091 Register input = ToRegister(instr->InputAt(0));
2092 __ movq(result, FieldOperand(input, JSObject::kElementsOffset)); 2092 __ movq(result, FieldOperand(input, JSObject::kElementsOffset));
2093 if (FLAG_debug_code) { 2093 if (FLAG_debug_code) {
2094 NearLabel done; 2094 NearLabel done;
2095 __ Cmp(FieldOperand(result, HeapObject::kMapOffset), 2095 __ CompareRoot(FieldOperand(result, HeapObject::kMapOffset),
2096 FACTORY->fixed_array_map()); 2096 Heap::kFixedArrayMapRootIndex);
2097 __ j(equal, &done); 2097 __ j(equal, &done);
2098 __ Cmp(FieldOperand(result, HeapObject::kMapOffset), 2098 __ CompareRoot(FieldOperand(result, HeapObject::kMapOffset),
2099 FACTORY->external_pixel_array_map()); 2099 Heap::kExternalPixelArrayMapRootIndex);
2100 __ j(equal, &done); 2100 __ j(equal, &done);
2101 __ Cmp(FieldOperand(result, HeapObject::kMapOffset), 2101 __ CompareRoot(FieldOperand(result, HeapObject::kMapOffset),
2102 FACTORY->fixed_cow_array_map()); 2102 Heap::kFixedCOWArrayMapRootIndex);
2103 __ Check(equal, "Check for fast elements failed."); 2103 __ Check(equal, "Check for fast elements failed.");
2104 __ bind(&done); 2104 __ bind(&done);
2105 } 2105 }
2106 } 2106 }
2107 2107
2108 2108
2109 void LCodeGen::DoLoadExternalArrayPointer( 2109 void LCodeGen::DoLoadExternalArrayPointer(
2110 LLoadExternalArrayPointer* instr) { 2110 LLoadExternalArrayPointer* instr) {
2111 Register result = ToRegister(instr->result()); 2111 Register result = ToRegister(instr->result());
2112 Register input = ToRegister(instr->InputAt(0)); 2112 Register input = ToRegister(instr->InputAt(0));
(...skipping 26 matching lines...) Expand all
2139 Register result = ToRegister(instr->result()); 2139 Register result = ToRegister(instr->result());
2140 ASSERT(result.is(elements)); 2140 ASSERT(result.is(elements));
2141 2141
2142 // Load the result. 2142 // Load the result.
2143 __ movq(result, FieldOperand(elements, 2143 __ movq(result, FieldOperand(elements,
2144 key, 2144 key,
2145 times_pointer_size, 2145 times_pointer_size,
2146 FixedArray::kHeaderSize)); 2146 FixedArray::kHeaderSize));
2147 2147
2148 // Check for the hole value. 2148 // Check for the hole value.
2149 __ Cmp(result, FACTORY->the_hole_value()); 2149 __ CompareRoot(result, Heap::kTheHoleValueRootIndex);
2150 DeoptimizeIf(equal, instr->environment()); 2150 DeoptimizeIf(equal, instr->environment());
2151 } 2151 }
2152 2152
2153 2153
2154 void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) { 2154 void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) {
2155 Register external_elements = ToRegister(instr->external_pointer()); 2155 Register external_elements = ToRegister(instr->external_pointer());
2156 Register key = ToRegister(instr->key()); 2156 Register key = ToRegister(instr->key());
2157 Register result = ToRegister(instr->result()); 2157 Register result = ToRegister(instr->result());
2158 ASSERT(result.is(external_elements)); 2158 ASSERT(result.is(external_elements));
2159 2159
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { 2607 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
2608 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); 2608 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
2609 TranscendentalCacheStub stub(TranscendentalCache::LOG, 2609 TranscendentalCacheStub stub(TranscendentalCache::LOG,
2610 TranscendentalCacheStub::UNTAGGED); 2610 TranscendentalCacheStub::UNTAGGED);
2611 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 2611 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2612 } 2612 }
2613 2613
2614 2614
2615 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) { 2615 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) {
2616 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); 2616 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
2617 TranscendentalCacheStub stub(TranscendentalCache::LOG, 2617 TranscendentalCacheStub stub(TranscendentalCache::COS,
2618 TranscendentalCacheStub::UNTAGGED); 2618 TranscendentalCacheStub::UNTAGGED);
2619 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 2619 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2620 } 2620 }
2621 2621
2622 2622
2623 void LCodeGen::DoMathSin(LUnaryMathOperation* instr) { 2623 void LCodeGen::DoMathSin(LUnaryMathOperation* instr) {
2624 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); 2624 ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
2625 TranscendentalCacheStub stub(TranscendentalCache::LOG, 2625 TranscendentalCacheStub stub(TranscendentalCache::SIN,
2626 TranscendentalCacheStub::UNTAGGED); 2626 TranscendentalCacheStub::UNTAGGED);
2627 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 2627 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
2628 } 2628 }
2629 2629
2630 2630
2631 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { 2631 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
2632 switch (instr->op()) { 2632 switch (instr->op()) {
2633 case kMathAbs: 2633 case kMathAbs:
2634 DoMathAbs(instr); 2634 DoMathAbs(instr);
2635 break; 2635 break;
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
3432 // space for nested functions that don't need literals cloning. 3432 // space for nested functions that don't need literals cloning.
3433 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); 3433 Handle<SharedFunctionInfo> shared_info = instr->shared_info();
3434 bool pretenure = instr->hydrogen()->pretenure(); 3434 bool pretenure = instr->hydrogen()->pretenure();
3435 if (shared_info->num_literals() == 0 && !pretenure) { 3435 if (shared_info->num_literals() == 0 && !pretenure) {
3436 FastNewClosureStub stub; 3436 FastNewClosureStub stub;
3437 __ Push(shared_info); 3437 __ Push(shared_info);
3438 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 3438 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3439 } else { 3439 } else {
3440 __ push(rsi); 3440 __ push(rsi);
3441 __ Push(shared_info); 3441 __ Push(shared_info);
3442 __ Push(pretenure ? FACTORY->true_value() : FACTORY->false_value()); 3442 __ PushRoot(pretenure ?
3443 Heap::kTrueValueRootIndex :
3444 Heap::kFalseValueRootIndex);
3443 CallRuntime(Runtime::kNewClosure, 3, instr); 3445 CallRuntime(Runtime::kNewClosure, 3, instr);
3444 } 3446 }
3445 } 3447 }
3446 3448
3447 3449
3448 void LCodeGen::DoTypeof(LTypeof* instr) { 3450 void LCodeGen::DoTypeof(LTypeof* instr) {
3449 LOperand* input = instr->InputAt(0); 3451 LOperand* input = instr->InputAt(0);
3450 if (input->IsConstantOperand()) { 3452 if (input->IsConstantOperand()) {
3451 __ Push(ToHandle(LConstantOperand::cast(input))); 3453 __ Push(ToHandle(LConstantOperand::cast(input)));
3452 } else if (input->IsRegister()) { 3454 } else if (input->IsRegister()) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
3515 } 3517 }
3516 3518
3517 3519
3518 Condition LCodeGen::EmitTypeofIs(Label* true_label, 3520 Condition LCodeGen::EmitTypeofIs(Label* true_label,
3519 Label* false_label, 3521 Label* false_label,
3520 Register input, 3522 Register input,
3521 Handle<String> type_name) { 3523 Handle<String> type_name) {
3522 Condition final_branch_condition = no_condition; 3524 Condition final_branch_condition = no_condition;
3523 if (type_name->Equals(HEAP->number_symbol())) { 3525 if (type_name->Equals(HEAP->number_symbol())) {
3524 __ JumpIfSmi(input, true_label); 3526 __ JumpIfSmi(input, true_label);
3525 __ Cmp(FieldOperand(input, HeapObject::kMapOffset), 3527 __ CompareRoot(FieldOperand(input, HeapObject::kMapOffset),
3526 FACTORY->heap_number_map()); 3528 Heap::kHeapNumberMapRootIndex);
3529
3527 final_branch_condition = equal; 3530 final_branch_condition = equal;
3528 3531
3529 } else if (type_name->Equals(HEAP->string_symbol())) { 3532 } else if (type_name->Equals(HEAP->string_symbol())) {
3530 __ JumpIfSmi(input, false_label); 3533 __ JumpIfSmi(input, false_label);
3531 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); 3534 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input);
3532 __ j(above_equal, false_label); 3535 __ j(above_equal, false_label);
3533 __ testb(FieldOperand(input, Map::kBitFieldOffset), 3536 __ testb(FieldOperand(input, Map::kBitFieldOffset),
3534 Immediate(1 << Map::kIsUndetectable)); 3537 Immediate(1 << Map::kIsUndetectable));
3535 final_branch_condition = zero; 3538 final_branch_condition = zero;
3536 3539
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
3696 RegisterEnvironmentForDeoptimization(environment); 3699 RegisterEnvironmentForDeoptimization(environment);
3697 ASSERT(osr_pc_offset_ == -1); 3700 ASSERT(osr_pc_offset_ == -1);
3698 osr_pc_offset_ = masm()->pc_offset(); 3701 osr_pc_offset_ = masm()->pc_offset();
3699 } 3702 }
3700 3703
3701 #undef __ 3704 #undef __
3702 3705
3703 } } // namespace v8::internal 3706 } } // namespace v8::internal
3704 3707
3705 #endif // V8_TARGET_ARCH_X64 3708 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/deoptimizer-x64.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698