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