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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 3284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3295 | 3295 |
3296 __ JumpIfSmi(eax, if_false); | 3296 __ JumpIfSmi(eax, if_false); |
3297 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); | 3297 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); |
3298 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3298 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3299 Split(equal, if_true, if_false, fall_through); | 3299 Split(equal, if_true, if_false, fall_through); |
3300 | 3300 |
3301 context()->Plug(if_true, if_false); | 3301 context()->Plug(if_true, if_false); |
3302 } | 3302 } |
3303 | 3303 |
3304 | 3304 |
| 3305 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
| 3306 ZoneList<Expression*>* args = expr->arguments(); |
| 3307 DCHECK(args->length() == 2); |
| 3308 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); |
| 3309 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
| 3310 |
| 3311 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3312 |
| 3313 Register object = eax; |
| 3314 Register result = eax; |
| 3315 Register scratch = ecx; |
| 3316 |
| 3317 if (index->value() == 0) { |
| 3318 __ mov(result, FieldOperand(object, JSDate::kValueOffset)); |
| 3319 } else { |
| 3320 Label runtime, done; |
| 3321 if (index->value() < JSDate::kFirstUncachedField) { |
| 3322 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
| 3323 __ mov(scratch, Operand::StaticVariable(stamp)); |
| 3324 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); |
| 3325 __ j(not_equal, &runtime, Label::kNear); |
| 3326 __ mov(result, FieldOperand(object, JSDate::kValueOffset + |
| 3327 kPointerSize * index->value())); |
| 3328 __ jmp(&done, Label::kNear); |
| 3329 } |
| 3330 __ bind(&runtime); |
| 3331 __ PrepareCallCFunction(2, scratch); |
| 3332 __ mov(Operand(esp, 0), object); |
| 3333 __ mov(Operand(esp, 1 * kPointerSize), Immediate(index)); |
| 3334 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
| 3335 __ bind(&done); |
| 3336 } |
| 3337 |
| 3338 context()->Plug(result); |
| 3339 } |
| 3340 |
| 3341 |
3305 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | 3342 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { |
3306 ZoneList<Expression*>* args = expr->arguments(); | 3343 ZoneList<Expression*>* args = expr->arguments(); |
3307 DCHECK_EQ(3, args->length()); | 3344 DCHECK_EQ(3, args->length()); |
3308 | 3345 |
3309 Register string = eax; | 3346 Register string = eax; |
3310 Register index = ebx; | 3347 Register index = ebx; |
3311 Register value = ecx; | 3348 Register value = ecx; |
3312 | 3349 |
3313 VisitForStackValue(args->at(0)); // index | 3350 VisitForStackValue(args->at(0)); // index |
3314 VisitForStackValue(args->at(1)); // value | 3351 VisitForStackValue(args->at(1)); // value |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4739 Assembler::target_address_at(call_target_address, | 4776 Assembler::target_address_at(call_target_address, |
4740 unoptimized_code)); | 4777 unoptimized_code)); |
4741 return OSR_AFTER_STACK_CHECK; | 4778 return OSR_AFTER_STACK_CHECK; |
4742 } | 4779 } |
4743 | 4780 |
4744 | 4781 |
4745 } // namespace internal | 4782 } // namespace internal |
4746 } // namespace v8 | 4783 } // namespace v8 |
4747 | 4784 |
4748 #endif // V8_TARGET_ARCH_X87 | 4785 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |