| 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 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 3217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3228 &if_true, &if_false, &fall_through); | 3228 &if_true, &if_false, &fall_through); |
| 3229 | 3229 |
| 3230 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3230 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 3231 __ JumpIfSmi(rax, if_true); | 3231 __ JumpIfSmi(rax, if_true); |
| 3232 __ jmp(if_false); | 3232 __ jmp(if_false); |
| 3233 | 3233 |
| 3234 context()->Plug(if_true, if_false); | 3234 context()->Plug(if_true, if_false); |
| 3235 } | 3235 } |
| 3236 | 3236 |
| 3237 | 3237 |
| 3238 void FullCodeGenerator::EmitIsNonNegativeSmi(CallRuntime* expr) { | |
| 3239 ZoneList<Expression*>* args = expr->arguments(); | |
| 3240 DCHECK(args->length() == 1); | |
| 3241 | |
| 3242 VisitForAccumulatorValue(args->at(0)); | |
| 3243 | |
| 3244 Label materialize_true, materialize_false; | |
| 3245 Label* if_true = NULL; | |
| 3246 Label* if_false = NULL; | |
| 3247 Label* fall_through = NULL; | |
| 3248 context()->PrepareTest(&materialize_true, &materialize_false, | |
| 3249 &if_true, &if_false, &fall_through); | |
| 3250 | |
| 3251 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
| 3252 Condition non_negative_smi = masm()->CheckNonNegativeSmi(rax); | |
| 3253 Split(non_negative_smi, if_true, if_false, fall_through); | |
| 3254 | |
| 3255 context()->Plug(if_true, if_false); | |
| 3256 } | |
| 3257 | |
| 3258 | |
| 3259 void FullCodeGenerator::EmitIsObject(CallRuntime* expr) { | 3238 void FullCodeGenerator::EmitIsObject(CallRuntime* expr) { |
| 3260 ZoneList<Expression*>* args = expr->arguments(); | 3239 ZoneList<Expression*>* args = expr->arguments(); |
| 3261 DCHECK(args->length() == 1); | 3240 DCHECK(args->length() == 1); |
| 3262 | 3241 |
| 3263 VisitForAccumulatorValue(args->at(0)); | 3242 VisitForAccumulatorValue(args->at(0)); |
| 3264 | 3243 |
| 3265 Label materialize_true, materialize_false; | 3244 Label materialize_true, materialize_false; |
| 3266 Label* if_true = NULL; | 3245 Label* if_true = NULL; |
| 3267 Label* if_false = NULL; | 3246 Label* if_false = NULL; |
| 3268 Label* fall_through = NULL; | 3247 Label* fall_through = NULL; |
| (...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5027 Label* if_false = NULL; | 5006 Label* if_false = NULL; |
| 5028 Label* fall_through = NULL; | 5007 Label* fall_through = NULL; |
| 5029 context()->PrepareTest(&materialize_true, &materialize_false, | 5008 context()->PrepareTest(&materialize_true, &materialize_false, |
| 5030 &if_true, &if_false, &fall_through); | 5009 &if_true, &if_false, &fall_through); |
| 5031 | 5010 |
| 5032 Token::Value op = expr->op(); | 5011 Token::Value op = expr->op(); |
| 5033 VisitForStackValue(expr->left()); | 5012 VisitForStackValue(expr->left()); |
| 5034 switch (op) { | 5013 switch (op) { |
| 5035 case Token::IN: | 5014 case Token::IN: |
| 5036 VisitForStackValue(expr->right()); | 5015 VisitForStackValue(expr->right()); |
| 5037 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION); | 5016 __ CallRuntime(Runtime::kHasProperty, 2); |
| 5038 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 5017 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
| 5039 __ CompareRoot(rax, Heap::kTrueValueRootIndex); | 5018 __ CompareRoot(rax, Heap::kTrueValueRootIndex); |
| 5040 Split(equal, if_true, if_false, fall_through); | 5019 Split(equal, if_true, if_false, fall_through); |
| 5041 break; | 5020 break; |
| 5042 | 5021 |
| 5043 case Token::INSTANCEOF: { | 5022 case Token::INSTANCEOF: { |
| 5044 VisitForStackValue(expr->right()); | 5023 VisitForStackValue(expr->right()); |
| 5045 InstanceofStub stub(isolate(), InstanceofStub::kNoFlags); | 5024 InstanceofStub stub(isolate(), InstanceofStub::kNoFlags); |
| 5046 __ CallStub(&stub); | 5025 __ CallStub(&stub); |
| 5047 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5026 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5301 Assembler::target_address_at(call_target_address, | 5280 Assembler::target_address_at(call_target_address, |
| 5302 unoptimized_code)); | 5281 unoptimized_code)); |
| 5303 return OSR_AFTER_STACK_CHECK; | 5282 return OSR_AFTER_STACK_CHECK; |
| 5304 } | 5283 } |
| 5305 | 5284 |
| 5306 | 5285 |
| 5307 } // namespace internal | 5286 } // namespace internal |
| 5308 } // namespace v8 | 5287 } // namespace v8 |
| 5309 | 5288 |
| 5310 #endif // V8_TARGET_ARCH_X64 | 5289 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |