OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 3225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3236 &if_true, &if_false, &fall_through); | 3236 &if_true, &if_false, &fall_through); |
3237 | 3237 |
3238 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3238 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3239 __ test(eax, Immediate(kSmiTagMask)); | 3239 __ test(eax, Immediate(kSmiTagMask)); |
3240 Split(zero, if_true, if_false, fall_through); | 3240 Split(zero, if_true, if_false, fall_through); |
3241 | 3241 |
3242 context()->Plug(if_true, if_false); | 3242 context()->Plug(if_true, if_false); |
3243 } | 3243 } |
3244 | 3244 |
3245 | 3245 |
3246 void FullCodeGenerator::EmitIsNonNegativeSmi(CallRuntime* expr) { | |
3247 ZoneList<Expression*>* args = expr->arguments(); | |
3248 DCHECK(args->length() == 1); | |
3249 | |
3250 VisitForAccumulatorValue(args->at(0)); | |
3251 | |
3252 Label materialize_true, materialize_false; | |
3253 Label* if_true = NULL; | |
3254 Label* if_false = NULL; | |
3255 Label* fall_through = NULL; | |
3256 context()->PrepareTest(&materialize_true, &materialize_false, | |
3257 &if_true, &if_false, &fall_through); | |
3258 | |
3259 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
3260 __ test(eax, Immediate(kSmiTagMask | 0x80000000)); | |
3261 Split(zero, if_true, if_false, fall_through); | |
3262 | |
3263 context()->Plug(if_true, if_false); | |
3264 } | |
3265 | |
3266 | |
3267 void FullCodeGenerator::EmitIsObject(CallRuntime* expr) { | 3246 void FullCodeGenerator::EmitIsObject(CallRuntime* expr) { |
3268 ZoneList<Expression*>* args = expr->arguments(); | 3247 ZoneList<Expression*>* args = expr->arguments(); |
3269 DCHECK(args->length() == 1); | 3248 DCHECK(args->length() == 1); |
3270 | 3249 |
3271 VisitForAccumulatorValue(args->at(0)); | 3250 VisitForAccumulatorValue(args->at(0)); |
3272 | 3251 |
3273 Label materialize_true, materialize_false; | 3252 Label materialize_true, materialize_false; |
3274 Label* if_true = NULL; | 3253 Label* if_true = NULL; |
3275 Label* if_false = NULL; | 3254 Label* if_false = NULL; |
3276 Label* fall_through = NULL; | 3255 Label* fall_through = NULL; |
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5018 Label* if_false = NULL; | 4997 Label* if_false = NULL; |
5019 Label* fall_through = NULL; | 4998 Label* fall_through = NULL; |
5020 context()->PrepareTest(&materialize_true, &materialize_false, | 4999 context()->PrepareTest(&materialize_true, &materialize_false, |
5021 &if_true, &if_false, &fall_through); | 5000 &if_true, &if_false, &fall_through); |
5022 | 5001 |
5023 Token::Value op = expr->op(); | 5002 Token::Value op = expr->op(); |
5024 VisitForStackValue(expr->left()); | 5003 VisitForStackValue(expr->left()); |
5025 switch (op) { | 5004 switch (op) { |
5026 case Token::IN: | 5005 case Token::IN: |
5027 VisitForStackValue(expr->right()); | 5006 VisitForStackValue(expr->right()); |
5028 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION); | 5007 __ CallRuntime(Runtime::kHasProperty, 2); |
5029 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 5008 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
5030 __ cmp(eax, isolate()->factory()->true_value()); | 5009 __ cmp(eax, isolate()->factory()->true_value()); |
5031 Split(equal, if_true, if_false, fall_through); | 5010 Split(equal, if_true, if_false, fall_through); |
5032 break; | 5011 break; |
5033 | 5012 |
5034 case Token::INSTANCEOF: { | 5013 case Token::INSTANCEOF: { |
5035 VisitForStackValue(expr->right()); | 5014 VisitForStackValue(expr->right()); |
5036 InstanceofStub stub(isolate(), InstanceofStub::kNoFlags); | 5015 InstanceofStub stub(isolate(), InstanceofStub::kNoFlags); |
5037 __ CallStub(&stub); | 5016 __ CallStub(&stub); |
5038 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5017 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5291 Assembler::target_address_at(call_target_address, | 5270 Assembler::target_address_at(call_target_address, |
5292 unoptimized_code)); | 5271 unoptimized_code)); |
5293 return OSR_AFTER_STACK_CHECK; | 5272 return OSR_AFTER_STACK_CHECK; |
5294 } | 5273 } |
5295 | 5274 |
5296 | 5275 |
5297 } // namespace internal | 5276 } // namespace internal |
5298 } // namespace v8 | 5277 } // namespace v8 |
5299 | 5278 |
5300 #endif // V8_TARGET_ARCH_IA32 | 5279 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |