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

Side by Side Diff: src/codegen-ia32.cc

Issue 4084: Remove ComparisonDeferred and inline the non-smi case. (Closed)
Patch Set: Typos Created 12 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 2466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2477 2477
2478 // Do tail-call to runtime routine. 2478 // Do tail-call to runtime routine.
2479 __ TailCallRuntime(ExternalReference(Runtime::kStackGuard), 1); 2479 __ TailCallRuntime(ExternalReference(Runtime::kStackGuard), 1);
2480 } 2480 }
2481 2481
2482 2482
2483 #undef __ 2483 #undef __
2484 #define __ masm_-> 2484 #define __ masm_->
2485 2485
2486 2486
2487 class ComparisonDeferred: public DeferredCode {
2488 public:
2489 ComparisonDeferred(CodeGenerator* generator, Condition cc, bool strict) :
2490 DeferredCode(generator), cc_(cc), strict_(strict) {
2491 set_comment("[ ComparisonDeferred");
2492 }
2493 virtual void Generate();
2494
2495 private:
2496 Condition cc_;
2497 bool strict_;
2498 };
2499
2500
2501 void ComparisonDeferred::Generate() {
2502 CompareStub stub(cc_, strict_);
2503 // "parameters" setup by calling code in edx and eax
2504 __ CallStub(&stub);
2505 __ cmp(eax, 0);
2506 // "result" is returned in the flags
2507 }
2508
2509
2510 void Ia32CodeGenerator::Comparison(Condition cc, bool strict) { 2487 void Ia32CodeGenerator::Comparison(Condition cc, bool strict) {
2511 // Strict only makes sense for equality comparisons. 2488 // Strict only makes sense for equality comparisons.
2512 ASSERT(!strict || cc == equal); 2489 ASSERT(!strict || cc == equal);
2513 2490
2514 // Implement '>' and '<=' by reversal to obtain ECMA-262 conversion order. 2491 // Implement '>' and '<=' by reversal to obtain ECMA-262 conversion order.
2515 if (cc == greater || cc == less_equal) { 2492 if (cc == greater || cc == less_equal) {
2516 cc = ReverseCondition(cc); 2493 cc = ReverseCondition(cc);
2517 __ pop(edx); 2494 __ pop(edx);
2518 __ pop(eax); 2495 __ pop(eax);
2519 } else { 2496 } else {
2520 __ pop(eax); 2497 __ pop(eax);
2521 __ pop(edx); 2498 __ pop(edx);
2522 } 2499 }
2523 ComparisonDeferred* deferred = new ComparisonDeferred(this, cc, strict); 2500
2501 Label is_smi, done;
2502 CompareStub stub(cc, strict);
2503
2524 __ mov(ecx, Operand(eax)); 2504 __ mov(ecx, Operand(eax));
2525 __ or_(ecx, Operand(edx)); 2505 __ or_(ecx, Operand(edx));
2526 __ test(ecx, Immediate(kSmiTagMask)); 2506 __ test(ecx, Immediate(kSmiTagMask));
2527 __ j(not_zero, deferred->enter(), not_taken); 2507 __ j(zero, &is_smi, taken);
2508
2509 // When non-smi, call out to the compare stub
2510 // "parameters" setup by calling code in edx and eax
2511 // "result" is returned in the flags
2512 __ CallStub(&stub);
2513 __ cmp(eax, 0);
2514 __ jmp(&done);
2515
2528 // Test smi equality by pointer comparison. 2516 // Test smi equality by pointer comparison.
2517 __ bind(&is_smi);
2529 __ cmp(edx, Operand(eax)); 2518 __ cmp(edx, Operand(eax));
2530 __ bind(deferred->exit()); 2519 // Fall through to |done|.
2520
2521 __ bind(&done);
2531 cc_reg_ = cc; 2522 cc_reg_ = cc;
2532 } 2523 }
2533 2524
2534 2525
2535 class SmiComparisonDeferred: public DeferredCode { 2526 class SmiComparisonDeferred: public DeferredCode {
2536 public: 2527 public:
2537 SmiComparisonDeferred(CodeGenerator* generator, 2528 SmiComparisonDeferred(CodeGenerator* generator,
2538 Condition cc, 2529 Condition cc,
2539 bool strict, 2530 bool strict,
2540 int value) 2531 int value)
(...skipping 2949 matching lines...) Expand 10 before | Expand all | Expand 10 after
5490 bool is_eval) { 5481 bool is_eval) {
5491 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval); 5482 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval);
5492 if (!code.is_null()) { 5483 if (!code.is_null()) {
5493 Counters::total_compiled_code_size.Increment(code->instruction_size()); 5484 Counters::total_compiled_code_size.Increment(code->instruction_size());
5494 } 5485 }
5495 return code; 5486 return code;
5496 } 5487 }
5497 5488
5498 5489
5499 } } // namespace v8::internal 5490 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698