OLD | NEW |
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 4000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4011 Split(cc, if_true, if_false, fall_through); | 4011 Split(cc, if_true, if_false, fall_through); |
4012 } | 4012 } |
4013 } | 4013 } |
4014 | 4014 |
4015 // Convert the result of the comparison into one expected for this | 4015 // Convert the result of the comparison into one expected for this |
4016 // expression's context. | 4016 // expression's context. |
4017 context()->Plug(if_true, if_false); | 4017 context()->Plug(if_true, if_false); |
4018 } | 4018 } |
4019 | 4019 |
4020 | 4020 |
4021 void FullCodeGenerator::VisitCompareToNull(CompareToNull* expr) { | 4021 void FullCodeGenerator::EmitLiteralCompareNull(Expression* expr, |
4022 Comment cmnt(masm_, "[ CompareToNull"); | 4022 bool is_strict, |
4023 Label materialize_true, materialize_false; | 4023 Label* if_true, |
4024 Label* if_true = NULL; | 4024 Label* if_false, |
4025 Label* if_false = NULL; | 4025 Label* fall_through) { |
4026 Label* fall_through = NULL; | 4026 VisitForAccumulatorValue(expr); |
4027 context()->PrepareTest(&materialize_true, &materialize_false, | |
4028 &if_true, &if_false, &fall_through); | |
4029 | |
4030 VisitForAccumulatorValue(expr->expression()); | |
4031 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 4027 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
4032 __ CompareRoot(rax, Heap::kNullValueRootIndex); | 4028 __ CompareRoot(rax, Heap::kNullValueRootIndex); |
4033 if (expr->is_strict()) { | 4029 if (is_strict) { |
4034 Split(equal, if_true, if_false, fall_through); | 4030 Split(equal, if_true, if_false, fall_through); |
4035 } else { | 4031 } else { |
4036 __ j(equal, if_true); | 4032 __ j(equal, if_true); |
4037 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); | 4033 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
4038 __ j(equal, if_true); | 4034 __ j(equal, if_true); |
4039 __ JumpIfSmi(rax, if_false); | 4035 __ JumpIfSmi(rax, if_false); |
4040 // It can be an undetectable object. | 4036 // It can be an undetectable object. |
4041 __ movq(rdx, FieldOperand(rax, HeapObject::kMapOffset)); | 4037 __ movq(rdx, FieldOperand(rax, HeapObject::kMapOffset)); |
4042 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), | 4038 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), |
4043 Immediate(1 << Map::kIsUndetectable)); | 4039 Immediate(1 << Map::kIsUndetectable)); |
4044 Split(not_zero, if_true, if_false, fall_through); | 4040 Split(not_zero, if_true, if_false, fall_through); |
4045 } | 4041 } |
4046 context()->Plug(if_true, if_false); | |
4047 } | 4042 } |
4048 | 4043 |
4049 | 4044 |
4050 void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 4045 void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
4051 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 4046 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
4052 context()->Plug(rax); | 4047 context()->Plug(rax); |
4053 } | 4048 } |
4054 | 4049 |
4055 | 4050 |
4056 Register FullCodeGenerator::result_register() { | 4051 Register FullCodeGenerator::result_register() { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4151 *context_length = 0; | 4146 *context_length = 0; |
4152 return previous_; | 4147 return previous_; |
4153 } | 4148 } |
4154 | 4149 |
4155 | 4150 |
4156 #undef __ | 4151 #undef __ |
4157 | 4152 |
4158 } } // namespace v8::internal | 4153 } } // namespace v8::internal |
4159 | 4154 |
4160 #endif // V8_TARGET_ARCH_X64 | 4155 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |