| Index: src/ia32/full-codegen-ia32.cc
|
| ===================================================================
|
| --- src/ia32/full-codegen-ia32.cc (revision 9305)
|
| +++ src/ia32/full-codegen-ia32.cc (working copy)
|
| @@ -3961,10 +3961,14 @@
|
|
|
|
|
| void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
|
| - Handle<String> check,
|
| - Label* if_true,
|
| - Label* if_false,
|
| - Label* fall_through) {
|
| + Handle<String> check) {
|
| + Label materialize_true, materialize_false;
|
| + Label* if_true = NULL;
|
| + Label* if_false = NULL;
|
| + Label* fall_through = NULL;
|
| + context()->PrepareTest(&materialize_true, &materialize_false,
|
| + &if_true, &if_false, &fall_through);
|
| +
|
| { AccumulatorValueContext context(this);
|
| VisitForTypeofValue(expr);
|
| }
|
| @@ -4022,28 +4026,20 @@
|
| } else {
|
| if (if_false != fall_through) __ jmp(if_false);
|
| }
|
| + context()->Plug(if_true, if_false);
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitLiteralCompareUndefined(Expression* expr,
|
| - Label* if_true,
|
| - Label* if_false,
|
| - Label* fall_through) {
|
| - VisitForAccumulatorValue(expr);
|
| - PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
|
| -
|
| - __ cmp(eax, isolate()->factory()->undefined_value());
|
| - Split(equal, if_true, if_false, fall_through);
|
| -}
|
| -
|
| -
|
| void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
|
| Comment cmnt(masm_, "[ CompareOperation");
|
| SetSourcePosition(expr->position());
|
|
|
| + // First we try a fast inlined version of the compare when one of
|
| + // the operands is a literal.
|
| + if (TryLiteralCompare(expr)) return;
|
| +
|
| // Always perform the comparison for its control flow. Pack the result
|
| // into the expression's context after the comparison is performed.
|
| -
|
| Label materialize_true, materialize_false;
|
| Label* if_true = NULL;
|
| Label* if_false = NULL;
|
| @@ -4051,16 +4047,9 @@
|
| context()->PrepareTest(&materialize_true, &materialize_false,
|
| &if_true, &if_false, &fall_through);
|
|
|
| - // First we try a fast inlined version of the compare when one of
|
| - // the operands is a literal.
|
| - if (TryLiteralCompare(expr, if_true, if_false, fall_through)) {
|
| - context()->Plug(if_true, if_false);
|
| - return;
|
| - }
|
| -
|
| Token::Value op = expr->op();
|
| VisitForStackValue(expr->left());
|
| - switch (expr->op()) {
|
| + switch (op) {
|
| case Token::IN:
|
| VisitForStackValue(expr->right());
|
| __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION);
|
| @@ -4151,19 +4140,30 @@
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitLiteralCompareNull(Expression* expr,
|
| - bool is_strict,
|
| - Label* if_true,
|
| - Label* if_false,
|
| - Label* fall_through) {
|
| - VisitForAccumulatorValue(expr);
|
| +void FullCodeGenerator::EmitLiteralCompareNil(CompareOperation* expr,
|
| + Expression* sub_expr,
|
| + NilValue nil) {
|
| + Label materialize_true, materialize_false;
|
| + Label* if_true = NULL;
|
| + Label* if_false = NULL;
|
| + Label* fall_through = NULL;
|
| + context()->PrepareTest(&materialize_true, &materialize_false,
|
| + &if_true, &if_false, &fall_through);
|
| +
|
| + VisitForAccumulatorValue(sub_expr);
|
| PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
|
| - __ cmp(eax, isolate()->factory()->null_value());
|
| - if (is_strict) {
|
| + Handle<Object> nil_value = nil == kNullValue ?
|
| + isolate()->factory()->null_value() :
|
| + isolate()->factory()->undefined_value();
|
| + __ cmp(eax, nil_value);
|
| + if (expr->op() == Token::EQ_STRICT) {
|
| Split(equal, if_true, if_false, fall_through);
|
| } else {
|
| + Handle<Object> other_nil_value = nil == kNullValue ?
|
| + isolate()->factory()->undefined_value() :
|
| + isolate()->factory()->null_value();
|
| __ j(equal, if_true);
|
| - __ cmp(eax, isolate()->factory()->undefined_value());
|
| + __ cmp(eax, other_nil_value);
|
| __ j(equal, if_true);
|
| __ JumpIfSmi(eax, if_false);
|
| // It can be an undetectable object.
|
| @@ -4172,6 +4172,7 @@
|
| __ test(edx, Immediate(1 << Map::kIsUndetectable));
|
| Split(not_zero, if_true, if_false, fall_through);
|
| }
|
| + context()->Plug(if_true, if_false);
|
| }
|
|
|
|
|
|
|