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 3222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3233 Label* if_false = NULL; | 3233 Label* if_false = NULL; |
3234 Label* fall_through = NULL; | 3234 Label* fall_through = NULL; |
3235 context()->PrepareTest(&materialize_true, &materialize_false, | 3235 context()->PrepareTest(&materialize_true, &materialize_false, |
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 } |
| 3244 |
| 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); |
3243 } | 3264 } |
3244 | 3265 |
3245 | 3266 |
3246 void FullCodeGenerator::EmitIsObject(CallRuntime* expr) { | 3267 void FullCodeGenerator::EmitIsObject(CallRuntime* expr) { |
3247 ZoneList<Expression*>* args = expr->arguments(); | 3268 ZoneList<Expression*>* args = expr->arguments(); |
3248 DCHECK(args->length() == 1); | 3269 DCHECK(args->length() == 1); |
3249 | 3270 |
3250 VisitForAccumulatorValue(args->at(0)); | 3271 VisitForAccumulatorValue(args->at(0)); |
3251 | 3272 |
3252 Label materialize_true, materialize_false; | 3273 Label materialize_true, materialize_false; |
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4997 Label* if_false = NULL; | 5018 Label* if_false = NULL; |
4998 Label* fall_through = NULL; | 5019 Label* fall_through = NULL; |
4999 context()->PrepareTest(&materialize_true, &materialize_false, | 5020 context()->PrepareTest(&materialize_true, &materialize_false, |
5000 &if_true, &if_false, &fall_through); | 5021 &if_true, &if_false, &fall_through); |
5001 | 5022 |
5002 Token::Value op = expr->op(); | 5023 Token::Value op = expr->op(); |
5003 VisitForStackValue(expr->left()); | 5024 VisitForStackValue(expr->left()); |
5004 switch (op) { | 5025 switch (op) { |
5005 case Token::IN: | 5026 case Token::IN: |
5006 VisitForStackValue(expr->right()); | 5027 VisitForStackValue(expr->right()); |
5007 __ CallRuntime(Runtime::kHasProperty, 2); | 5028 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION); |
5008 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 5029 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
5009 __ cmp(eax, isolate()->factory()->true_value()); | 5030 __ cmp(eax, isolate()->factory()->true_value()); |
5010 Split(equal, if_true, if_false, fall_through); | 5031 Split(equal, if_true, if_false, fall_through); |
5011 break; | 5032 break; |
5012 | 5033 |
5013 case Token::INSTANCEOF: { | 5034 case Token::INSTANCEOF: { |
5014 VisitForStackValue(expr->right()); | 5035 VisitForStackValue(expr->right()); |
5015 InstanceofStub stub(isolate(), InstanceofStub::kNoFlags); | 5036 InstanceofStub stub(isolate(), InstanceofStub::kNoFlags); |
5016 __ CallStub(&stub); | 5037 __ CallStub(&stub); |
5017 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5038 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5270 Assembler::target_address_at(call_target_address, | 5291 Assembler::target_address_at(call_target_address, |
5271 unoptimized_code)); | 5292 unoptimized_code)); |
5272 return OSR_AFTER_STACK_CHECK; | 5293 return OSR_AFTER_STACK_CHECK; |
5273 } | 5294 } |
5274 | 5295 |
5275 | 5296 |
5276 } // namespace internal | 5297 } // namespace internal |
5277 } // namespace v8 | 5298 } // namespace v8 |
5278 | 5299 |
5279 #endif // V8_TARGET_ARCH_IA32 | 5300 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |