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

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

Issue 24366004: Split HCompareGeneric in a test and a branch part. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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
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 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 } 1027 }
1028 1028
1029 1029
1030 static const char* LabelType(LLabel* label) { 1030 static const char* LabelType(LLabel* label) {
1031 if (label->is_loop_header()) return " (loop header)"; 1031 if (label->is_loop_header()) return " (loop header)";
1032 if (label->is_osr_entry()) return " (OSR entry)"; 1032 if (label->is_osr_entry()) return " (OSR entry)";
1033 return ""; 1033 return "";
1034 } 1034 }
1035 1035
1036 1036
1037 static Condition ComputeCompareCondition(Token::Value op) {
1038 switch (op) {
1039 case Token::EQ_STRICT:
1040 case Token::EQ:
1041 return eq;
1042 case Token::LT:
1043 return lt;
1044 case Token::GT:
1045 return gt;
1046 case Token::LTE:
1047 return le;
1048 case Token::GTE:
1049 return ge;
1050 default:
1051 UNREACHABLE();
1052 return kNoCondition;
1053 }
1054 }
1055
1056
1037 void LCodeGen::DoLabel(LLabel* label) { 1057 void LCodeGen::DoLabel(LLabel* label) {
1038 Comment(";;; <@%d,#%d> -------------------- B%d%s --------------------", 1058 Comment(";;; <@%d,#%d> -------------------- B%d%s --------------------",
1039 current_instruction_, 1059 current_instruction_,
1040 label->hydrogen_value()->id(), 1060 label->hydrogen_value()->id(),
1041 label->block_id(), 1061 label->block_id(),
1042 LabelType(label)); 1062 LabelType(label));
1043 __ bind(label->label()); 1063 __ bind(label->label());
1044 current_block_ = label->block_id(); 1064 current_block_ = label->block_id();
1045 DoGap(label); 1065 DoGap(label);
1046 } 1066 }
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2205 int false_block = instr->FalseDestination(chunk_); 2225 int false_block = instr->FalseDestination(chunk_);
2206 __ b(condition, chunk_->GetAssemblyLabel(false_block)); 2226 __ b(condition, chunk_->GetAssemblyLabel(false_block));
2207 } 2227 }
2208 2228
2209 2229
2210 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { 2230 void LCodeGen::DoDebugBreak(LDebugBreak* instr) {
2211 __ stop("LBreak"); 2231 __ stop("LBreak");
2212 } 2232 }
2213 2233
2214 2234
2235 void LCodeGen::DoAndBranch(LAndBranch* instr) {
2236 Condition condition = ComputeCompareCondition(instr->op());
2237 __ cmp(ToRegister(instr->value()), Operand::Zero());
2238 EmitBranch(instr, condition);
2239 }
2240
2241
2215 void LCodeGen::DoBranch(LBranch* instr) { 2242 void LCodeGen::DoBranch(LBranch* instr) {
2216 Representation r = instr->hydrogen()->value()->representation(); 2243 Representation r = instr->hydrogen()->value()->representation();
2217 if (r.IsInteger32() || r.IsSmi()) { 2244 if (r.IsInteger32() || r.IsSmi()) {
2218 ASSERT(!info()->IsStub()); 2245 ASSERT(!info()->IsStub());
2219 Register reg = ToRegister(instr->value()); 2246 Register reg = ToRegister(instr->value());
2220 __ cmp(reg, Operand::Zero()); 2247 __ cmp(reg, Operand::Zero());
2221 EmitBranch(instr, ne); 2248 EmitBranch(instr, ne);
2222 } else if (r.IsDouble()) { 2249 } else if (r.IsDouble()) {
2223 ASSERT(!info()->IsStub()); 2250 ASSERT(!info()->IsStub());
2224 DwVfpRegister reg = ToDoubleRegister(instr->value()); 2251 DwVfpRegister reg = ToDoubleRegister(instr->value());
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
2543 if (!instr->hydrogen()->value()->IsHeapObject()) { 2570 if (!instr->hydrogen()->value()->IsHeapObject()) {
2544 __ JumpIfSmi(input, instr->FalseLabel(chunk_)); 2571 __ JumpIfSmi(input, instr->FalseLabel(chunk_));
2545 } 2572 }
2546 __ ldr(temp, FieldMemOperand(input, HeapObject::kMapOffset)); 2573 __ ldr(temp, FieldMemOperand(input, HeapObject::kMapOffset));
2547 __ ldrb(temp, FieldMemOperand(temp, Map::kBitFieldOffset)); 2574 __ ldrb(temp, FieldMemOperand(temp, Map::kBitFieldOffset));
2548 __ tst(temp, Operand(1 << Map::kIsUndetectable)); 2575 __ tst(temp, Operand(1 << Map::kIsUndetectable));
2549 EmitBranch(instr, ne); 2576 EmitBranch(instr, ne);
2550 } 2577 }
2551 2578
2552 2579
2553 static Condition ComputeCompareCondition(Token::Value op) {
2554 switch (op) {
2555 case Token::EQ_STRICT:
2556 case Token::EQ:
2557 return eq;
2558 case Token::LT:
2559 return lt;
2560 case Token::GT:
2561 return gt;
2562 case Token::LTE:
2563 return le;
2564 case Token::GTE:
2565 return ge;
2566 default:
2567 UNREACHABLE();
2568 return kNoCondition;
2569 }
2570 }
2571
2572
2573 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { 2580 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
2574 Token::Value op = instr->op(); 2581 Token::Value op = instr->op();
2575 2582
2576 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); 2583 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
2577 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2584 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2578 // This instruction also signals no smi code inlined. 2585 // This instruction also signals no smi code inlined.
2579 __ cmp(r0, Operand::Zero()); 2586 __ cmp(r0, Operand::Zero());
2580 2587
2581 Condition condition = ComputeCompareCondition(op); 2588 Condition condition = ComputeCompareCondition(op);
2582 2589
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2881 __ ldr(result, FieldMemOperand(object, HeapObject::kMapOffset)); 2888 __ ldr(result, FieldMemOperand(object, HeapObject::kMapOffset));
2882 __ ldrb(result, FieldMemOperand(result, Map::kInstanceSizeOffset)); 2889 __ ldrb(result, FieldMemOperand(result, Map::kInstanceSizeOffset));
2883 } 2890 }
2884 2891
2885 2892
2886 void LCodeGen::DoCmpT(LCmpT* instr) { 2893 void LCodeGen::DoCmpT(LCmpT* instr) {
2887 Token::Value op = instr->op(); 2894 Token::Value op = instr->op();
2888 2895
2889 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); 2896 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
2890 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2897 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2891 // This instruction also signals no smi code inlined. 2898 __ nop();
2892 __ cmp(r0, Operand::Zero());
2893 2899
2894 Condition condition = ComputeCompareCondition(op); 2900 Register res = ToRegister(instr->result());
2895 __ LoadRoot(ToRegister(instr->result()), 2901 if (!res.is(r0)) __ mov(res, r0);
2896 Heap::kTrueValueRootIndex,
2897 condition);
2898 __ LoadRoot(ToRegister(instr->result()),
2899 Heap::kFalseValueRootIndex,
2900 NegateCondition(condition));
2901 } 2902 }
2902 2903
2903 2904
2904 void LCodeGen::DoReturn(LReturn* instr) { 2905 void LCodeGen::DoReturn(LReturn* instr) {
2905 if (FLAG_trace && info()->IsOptimizing()) { 2906 if (FLAG_trace && info()->IsOptimizing()) {
2906 // Push the return value on the stack as the parameter. 2907 // Push the return value on the stack as the parameter.
2907 // Runtime::TraceExit returns its parameter in r0. 2908 // Runtime::TraceExit returns its parameter in r0.
2908 __ push(r0); 2909 __ push(r0);
2909 __ CallRuntime(Runtime::kTraceExit, 1); 2910 __ CallRuntime(Runtime::kTraceExit, 1);
2910 } 2911 }
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after
5782 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5783 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5783 __ ldr(result, FieldMemOperand(scratch, 5784 __ ldr(result, FieldMemOperand(scratch,
5784 FixedArray::kHeaderSize - kPointerSize)); 5785 FixedArray::kHeaderSize - kPointerSize));
5785 __ bind(&done); 5786 __ bind(&done);
5786 } 5787 }
5787 5788
5788 5789
5789 #undef __ 5790 #undef __
5790 5791
5791 } } // namespace v8::internal 5792 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/full-codegen.cc » ('j') | src/hydrogen.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698