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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 } 1318 }
1319 1319
1320 1320
1321 static const char* LabelType(LLabel* label) { 1321 static const char* LabelType(LLabel* label) {
1322 if (label->is_loop_header()) return " (loop header)"; 1322 if (label->is_loop_header()) return " (loop header)";
1323 if (label->is_osr_entry()) return " (OSR entry)"; 1323 if (label->is_osr_entry()) return " (OSR entry)";
1324 return ""; 1324 return "";
1325 } 1325 }
1326 1326
1327 1327
1328 static Condition ComputeCompareCondition(Token::Value op) {
1329 switch (op) {
1330 case Token::EQ_STRICT:
1331 case Token::EQ:
1332 return equal;
1333 case Token::LT:
1334 return less;
1335 case Token::GT:
1336 return greater;
1337 case Token::LTE:
1338 return less_equal;
1339 case Token::GTE:
1340 return greater_equal;
1341 default:
1342 UNREACHABLE();
1343 return no_condition;
1344 }
1345 }
1346
1347
1328 void LCodeGen::DoLabel(LLabel* label) { 1348 void LCodeGen::DoLabel(LLabel* label) {
1329 Comment(";;; <@%d,#%d> -------------------- B%d%s --------------------", 1349 Comment(";;; <@%d,#%d> -------------------- B%d%s --------------------",
1330 current_instruction_, 1350 current_instruction_,
1331 label->hydrogen_value()->id(), 1351 label->hydrogen_value()->id(),
1332 label->block_id(), 1352 label->block_id(),
1333 LabelType(label)); 1353 LabelType(label));
1334 __ bind(label->label()); 1354 __ bind(label->label());
1335 current_block_ = label->block_id(); 1355 current_block_ = label->block_id();
1336 DoGap(label); 1356 DoGap(label);
1337 } 1357 }
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 void LCodeGen::EmitFalseBranch(InstrType instr, Condition cc) { 2393 void LCodeGen::EmitFalseBranch(InstrType instr, Condition cc) {
2374 int false_block = instr->FalseDestination(chunk_); 2394 int false_block = instr->FalseDestination(chunk_);
2375 if (cc == no_condition) { 2395 if (cc == no_condition) {
2376 __ jmp(chunk_->GetAssemblyLabel(false_block)); 2396 __ jmp(chunk_->GetAssemblyLabel(false_block));
2377 } else { 2397 } else {
2378 __ j(cc, chunk_->GetAssemblyLabel(false_block)); 2398 __ j(cc, chunk_->GetAssemblyLabel(false_block));
2379 } 2399 }
2380 } 2400 }
2381 2401
2382 2402
2403 void LCodeGen::DoAndBranch(LAndBranch* instr) {
2404 Condition condition = ComputeCompareCondition(instr->op());
2405 __ test(ToRegister(instr->value()), ToRegister(instr->value()));
2406 EmitBranch(instr, condition);
2407 }
2408
2409
2383 void LCodeGen::DoBranch(LBranch* instr) { 2410 void LCodeGen::DoBranch(LBranch* instr) {
2384 Representation r = instr->hydrogen()->value()->representation(); 2411 Representation r = instr->hydrogen()->value()->representation();
2385 if (r.IsSmiOrInteger32()) { 2412 if (r.IsSmiOrInteger32()) {
2386 Register reg = ToRegister(instr->value()); 2413 Register reg = ToRegister(instr->value());
2387 __ test(reg, Operand(reg)); 2414 __ test(reg, Operand(reg));
2388 EmitBranch(instr, not_zero); 2415 EmitBranch(instr, not_zero);
2389 } else if (r.IsDouble()) { 2416 } else if (r.IsDouble()) {
2390 ASSERT(!info()->IsStub()); 2417 ASSERT(!info()->IsStub());
2391 CpuFeatureScope scope(masm(), SSE2); 2418 CpuFeatureScope scope(masm(), SSE2);
2392 XMMRegister reg = ToDoubleRegister(instr->value()); 2419 XMMRegister reg = ToDoubleRegister(instr->value());
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2746 STATIC_ASSERT(kSmiTag == 0); 2773 STATIC_ASSERT(kSmiTag == 0);
2747 __ JumpIfSmi(input, instr->FalseLabel(chunk_)); 2774 __ JumpIfSmi(input, instr->FalseLabel(chunk_));
2748 } 2775 }
2749 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); 2776 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset));
2750 __ test_b(FieldOperand(temp, Map::kBitFieldOffset), 2777 __ test_b(FieldOperand(temp, Map::kBitFieldOffset),
2751 1 << Map::kIsUndetectable); 2778 1 << Map::kIsUndetectable);
2752 EmitBranch(instr, not_zero); 2779 EmitBranch(instr, not_zero);
2753 } 2780 }
2754 2781
2755 2782
2756 static Condition ComputeCompareCondition(Token::Value op) {
2757 switch (op) {
2758 case Token::EQ_STRICT:
2759 case Token::EQ:
2760 return equal;
2761 case Token::LT:
2762 return less;
2763 case Token::GT:
2764 return greater;
2765 case Token::LTE:
2766 return less_equal;
2767 case Token::GTE:
2768 return greater_equal;
2769 default:
2770 UNREACHABLE();
2771 return no_condition;
2772 }
2773 }
2774
2775
2776 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { 2783 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
2777 Token::Value op = instr->op(); 2784 Token::Value op = instr->op();
2778 2785
2779 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); 2786 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
2780 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2787 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2781 2788
2782 Condition condition = ComputeCompareCondition(op); 2789 Condition condition = ComputeCompareCondition(op);
2783 __ test(eax, Operand(eax)); 2790 __ test(eax, Operand(eax));
2784 2791
2785 EmitBranch(instr, condition); 2792 EmitBranch(instr, condition);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
3051 __ mov(result, FieldOperand(object, HeapObject::kMapOffset)); 3058 __ mov(result, FieldOperand(object, HeapObject::kMapOffset));
3052 __ movzx_b(result, FieldOperand(result, Map::kInstanceSizeOffset)); 3059 __ movzx_b(result, FieldOperand(result, Map::kInstanceSizeOffset));
3053 } 3060 }
3054 3061
3055 3062
3056 void LCodeGen::DoCmpT(LCmpT* instr) { 3063 void LCodeGen::DoCmpT(LCmpT* instr) {
3057 Token::Value op = instr->op(); 3064 Token::Value op = instr->op();
3058 3065
3059 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); 3066 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
3060 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3067 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3068 __ nop();
titzer 2013/10/10 14:05:25 What's the nop for?
3061 3069
3062 Condition condition = ComputeCompareCondition(op); 3070 Register res = ToRegister(instr->result());
3063 Label true_value, done; 3071 if (!res.is(eax)) __ mov(res, eax);
3064 __ test(eax, Operand(eax));
3065 __ j(condition, &true_value, Label::kNear);
3066 __ mov(ToRegister(instr->result()), factory()->false_value());
3067 __ jmp(&done, Label::kNear);
3068 __ bind(&true_value);
3069 __ mov(ToRegister(instr->result()), factory()->true_value());
3070 __ bind(&done);
3071 } 3072 }
3072 3073
3073 3074
3074 void LCodeGen::EmitReturn(LReturn* instr, bool dynamic_frame_alignment) { 3075 void LCodeGen::EmitReturn(LReturn* instr, bool dynamic_frame_alignment) {
3075 int extra_value_count = dynamic_frame_alignment ? 2 : 1; 3076 int extra_value_count = dynamic_frame_alignment ? 2 : 1;
3076 3077
3077 if (instr->has_constant_parameter_count()) { 3078 if (instr->has_constant_parameter_count()) {
3078 int parameter_count = ToInteger32(instr->constant_parameter_count()); 3079 int parameter_count = ToInteger32(instr->constant_parameter_count());
3079 if (dynamic_frame_alignment && FLAG_debug_code) { 3080 if (dynamic_frame_alignment && FLAG_debug_code) {
3080 __ cmp(Operand(esp, 3081 __ cmp(Operand(esp,
(...skipping 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after
6403 FixedArray::kHeaderSize - kPointerSize)); 6404 FixedArray::kHeaderSize - kPointerSize));
6404 __ bind(&done); 6405 __ bind(&done);
6405 } 6406 }
6406 6407
6407 6408
6408 #undef __ 6409 #undef __
6409 6410
6410 } } // namespace v8::internal 6411 } } // namespace v8::internal
6411 6412
6412 #endif // V8_TARGET_ARCH_IA32 6413 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« src/hydrogen.h ('K') | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698