| 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 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3155 &if_true, &if_false, &fall_through); | 3155 &if_true, &if_false, &fall_through); |
| 3156 | 3156 |
| 3157 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3157 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 3158 __ JumpIfSmi(rax, if_true); | 3158 __ JumpIfSmi(rax, if_true); |
| 3159 __ jmp(if_false); | 3159 __ jmp(if_false); |
| 3160 | 3160 |
| 3161 context()->Plug(if_true, if_false); | 3161 context()->Plug(if_true, if_false); |
| 3162 } | 3162 } |
| 3163 | 3163 |
| 3164 | 3164 |
| 3165 void FullCodeGenerator::EmitIsNonNegativeSmi(CallRuntime* expr) { | |
| 3166 ZoneList<Expression*>* args = expr->arguments(); | |
| 3167 DCHECK(args->length() == 1); | |
| 3168 | |
| 3169 VisitForAccumulatorValue(args->at(0)); | |
| 3170 | |
| 3171 Label materialize_true, materialize_false; | |
| 3172 Label* if_true = NULL; | |
| 3173 Label* if_false = NULL; | |
| 3174 Label* fall_through = NULL; | |
| 3175 context()->PrepareTest(&materialize_true, &materialize_false, | |
| 3176 &if_true, &if_false, &fall_through); | |
| 3177 | |
| 3178 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
| 3179 Condition non_negative_smi = masm()->CheckNonNegativeSmi(rax); | |
| 3180 Split(non_negative_smi, if_true, if_false, fall_through); | |
| 3181 | |
| 3182 context()->Plug(if_true, if_false); | |
| 3183 } | |
| 3184 | |
| 3185 | |
| 3186 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { | 3165 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { |
| 3187 ZoneList<Expression*>* args = expr->arguments(); | 3166 ZoneList<Expression*>* args = expr->arguments(); |
| 3188 DCHECK(args->length() == 1); | 3167 DCHECK(args->length() == 1); |
| 3189 | 3168 |
| 3190 VisitForAccumulatorValue(args->at(0)); | 3169 VisitForAccumulatorValue(args->at(0)); |
| 3191 | 3170 |
| 3192 Label materialize_true, materialize_false; | 3171 Label materialize_true, materialize_false; |
| 3193 Label* if_true = NULL; | 3172 Label* if_true = NULL; |
| 3194 Label* if_false = NULL; | 3173 Label* if_false = NULL; |
| 3195 Label* fall_through = NULL; | 3174 Label* fall_through = NULL; |
| (...skipping 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4982 Label* if_false = NULL; | 4961 Label* if_false = NULL; |
| 4983 Label* fall_through = NULL; | 4962 Label* fall_through = NULL; |
| 4984 context()->PrepareTest(&materialize_true, &materialize_false, | 4963 context()->PrepareTest(&materialize_true, &materialize_false, |
| 4985 &if_true, &if_false, &fall_through); | 4964 &if_true, &if_false, &fall_through); |
| 4986 | 4965 |
| 4987 Token::Value op = expr->op(); | 4966 Token::Value op = expr->op(); |
| 4988 VisitForStackValue(expr->left()); | 4967 VisitForStackValue(expr->left()); |
| 4989 switch (op) { | 4968 switch (op) { |
| 4990 case Token::IN: | 4969 case Token::IN: |
| 4991 VisitForStackValue(expr->right()); | 4970 VisitForStackValue(expr->right()); |
| 4992 __ InvokeBuiltin(Context::IN_BUILTIN_INDEX, CALL_FUNCTION); | 4971 __ CallRuntime(Runtime::kHasProperty, 2); |
| 4993 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 4972 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
| 4994 __ CompareRoot(rax, Heap::kTrueValueRootIndex); | 4973 __ CompareRoot(rax, Heap::kTrueValueRootIndex); |
| 4995 Split(equal, if_true, if_false, fall_through); | 4974 Split(equal, if_true, if_false, fall_through); |
| 4996 break; | 4975 break; |
| 4997 | 4976 |
| 4998 case Token::INSTANCEOF: { | 4977 case Token::INSTANCEOF: { |
| 4999 VisitForAccumulatorValue(expr->right()); | 4978 VisitForAccumulatorValue(expr->right()); |
| 5000 __ Pop(rdx); | 4979 __ Pop(rdx); |
| 5001 InstanceOfStub stub(isolate()); | 4980 InstanceOfStub stub(isolate()); |
| 5002 __ CallStub(&stub); | 4981 __ CallStub(&stub); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5256 Assembler::target_address_at(call_target_address, | 5235 Assembler::target_address_at(call_target_address, |
| 5257 unoptimized_code)); | 5236 unoptimized_code)); |
| 5258 return OSR_AFTER_STACK_CHECK; | 5237 return OSR_AFTER_STACK_CHECK; |
| 5259 } | 5238 } |
| 5260 | 5239 |
| 5261 | 5240 |
| 5262 } // namespace internal | 5241 } // namespace internal |
| 5263 } // namespace v8 | 5242 } // namespace v8 |
| 5264 | 5243 |
| 5265 #endif // V8_TARGET_ARCH_X64 | 5244 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |