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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3291 | 3291 |
3292 __ JumpIfSmi(rax, if_false); | 3292 __ JumpIfSmi(rax, if_false); |
3293 __ CmpObjectType(rax, JS_DATE_TYPE, rbx); | 3293 __ CmpObjectType(rax, JS_DATE_TYPE, rbx); |
3294 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3294 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3295 Split(equal, if_true, if_false, fall_through); | 3295 Split(equal, if_true, if_false, fall_through); |
3296 | 3296 |
3297 context()->Plug(if_true, if_false); | 3297 context()->Plug(if_true, if_false); |
3298 } | 3298 } |
3299 | 3299 |
3300 | 3300 |
| 3301 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
| 3302 ZoneList<Expression*>* args = expr->arguments(); |
| 3303 DCHECK(args->length() == 2); |
| 3304 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); |
| 3305 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
| 3306 |
| 3307 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3308 |
| 3309 Register object = rax; |
| 3310 Register result = rax; |
| 3311 Register scratch = rcx; |
| 3312 |
| 3313 if (FLAG_debug_code) { |
| 3314 __ AssertNotSmi(object); |
| 3315 __ CmpObjectType(object, JS_DATE_TYPE, scratch); |
| 3316 __ Check(equal, kOperandIsNotADate); |
| 3317 } |
| 3318 |
| 3319 if (index->value() == 0) { |
| 3320 __ movp(result, FieldOperand(object, JSDate::kValueOffset)); |
| 3321 } else { |
| 3322 Label runtime, done; |
| 3323 if (index->value() < JSDate::kFirstUncachedField) { |
| 3324 __ Load(scratch, ExternalReference::date_cache_stamp(isolate())); |
| 3325 __ cmpp(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); |
| 3326 __ j(not_equal, &runtime, Label::kNear); |
| 3327 __ movp(result, FieldOperand(object, JSDate::kValueOffset + |
| 3328 kPointerSize * index->value())); |
| 3329 __ jmp(&done, Label::kNear); |
| 3330 } |
| 3331 __ bind(&runtime); |
| 3332 __ PrepareCallCFunction(2); |
| 3333 __ movp(arg_reg_1, object); |
| 3334 __ Move(arg_reg_2, index, Assembler::RelocInfoNone()); |
| 3335 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
| 3336 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 3337 __ bind(&done); |
| 3338 } |
| 3339 |
| 3340 context()->Plug(rax); |
| 3341 } |
| 3342 |
| 3343 |
3301 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | 3344 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { |
3302 ZoneList<Expression*>* args = expr->arguments(); | 3345 ZoneList<Expression*>* args = expr->arguments(); |
3303 DCHECK_EQ(3, args->length()); | 3346 DCHECK_EQ(3, args->length()); |
3304 | 3347 |
3305 Register string = rax; | 3348 Register string = rax; |
3306 Register index = rbx; | 3349 Register index = rbx; |
3307 Register value = rcx; | 3350 Register value = rcx; |
3308 | 3351 |
3309 VisitForStackValue(args->at(0)); // index | 3352 VisitForStackValue(args->at(0)); // index |
3310 VisitForStackValue(args->at(1)); // value | 3353 VisitForStackValue(args->at(1)); // value |
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4751 Assembler::target_address_at(call_target_address, | 4794 Assembler::target_address_at(call_target_address, |
4752 unoptimized_code)); | 4795 unoptimized_code)); |
4753 return OSR_AFTER_STACK_CHECK; | 4796 return OSR_AFTER_STACK_CHECK; |
4754 } | 4797 } |
4755 | 4798 |
4756 | 4799 |
4757 } // namespace internal | 4800 } // namespace internal |
4758 } // namespace v8 | 4801 } // namespace v8 |
4759 | 4802 |
4760 #endif // V8_TARGET_ARCH_X64 | 4803 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |