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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3303 | 3303 |
3304 __ JumpIfSmi(eax, if_false); | 3304 __ JumpIfSmi(eax, if_false); |
3305 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); | 3305 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); |
3306 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3306 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3307 Split(equal, if_true, if_false, fall_through); | 3307 Split(equal, if_true, if_false, fall_through); |
3308 | 3308 |
3309 context()->Plug(if_true, if_false); | 3309 context()->Plug(if_true, if_false); |
3310 } | 3310 } |
3311 | 3311 |
3312 | 3312 |
| 3313 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
| 3314 ZoneList<Expression*>* args = expr->arguments(); |
| 3315 DCHECK(args->length() == 2); |
| 3316 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); |
| 3317 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
| 3318 |
| 3319 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3320 |
| 3321 Register object = eax; |
| 3322 Register result = eax; |
| 3323 Register scratch = ecx; |
| 3324 |
| 3325 if (index->value() == 0) { |
| 3326 __ mov(result, FieldOperand(object, JSDate::kValueOffset)); |
| 3327 } else { |
| 3328 Label runtime, done; |
| 3329 if (index->value() < JSDate::kFirstUncachedField) { |
| 3330 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
| 3331 __ mov(scratch, Operand::StaticVariable(stamp)); |
| 3332 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); |
| 3333 __ j(not_equal, &runtime, Label::kNear); |
| 3334 __ mov(result, FieldOperand(object, JSDate::kValueOffset + |
| 3335 kPointerSize * index->value())); |
| 3336 __ jmp(&done, Label::kNear); |
| 3337 } |
| 3338 __ bind(&runtime); |
| 3339 __ PrepareCallCFunction(2, scratch); |
| 3340 __ mov(Operand(esp, 0), object); |
| 3341 __ mov(Operand(esp, 1 * kPointerSize), Immediate(index)); |
| 3342 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
| 3343 __ bind(&done); |
| 3344 } |
| 3345 |
| 3346 context()->Plug(result); |
| 3347 } |
| 3348 |
| 3349 |
3313 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | 3350 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { |
3314 ZoneList<Expression*>* args = expr->arguments(); | 3351 ZoneList<Expression*>* args = expr->arguments(); |
3315 DCHECK_EQ(3, args->length()); | 3352 DCHECK_EQ(3, args->length()); |
3316 | 3353 |
3317 Register string = eax; | 3354 Register string = eax; |
3318 Register index = ebx; | 3355 Register index = ebx; |
3319 Register value = ecx; | 3356 Register value = ecx; |
3320 | 3357 |
3321 VisitForStackValue(args->at(0)); // index | 3358 VisitForStackValue(args->at(0)); // index |
3322 VisitForStackValue(args->at(1)); // value | 3359 VisitForStackValue(args->at(1)); // value |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4747 Assembler::target_address_at(call_target_address, | 4784 Assembler::target_address_at(call_target_address, |
4748 unoptimized_code)); | 4785 unoptimized_code)); |
4749 return OSR_AFTER_STACK_CHECK; | 4786 return OSR_AFTER_STACK_CHECK; |
4750 } | 4787 } |
4751 | 4788 |
4752 | 4789 |
4753 } // namespace internal | 4790 } // namespace internal |
4754 } // namespace v8 | 4791 } // namespace v8 |
4755 | 4792 |
4756 #endif // V8_TARGET_ARCH_IA32 | 4793 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |