Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2426 | 2426 |
| 2427 // Check for the hole value. | 2427 // Check for the hole value. |
| 2428 if (instr->hydrogen()->RequiresHoleCheck()) { | 2428 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2429 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); | 2429 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
| 2430 __ cmp(result, scratch); | 2430 __ cmp(result, scratch); |
| 2431 DeoptimizeIf(eq, instr->environment()); | 2431 DeoptimizeIf(eq, instr->environment()); |
| 2432 } | 2432 } |
| 2433 } | 2433 } |
| 2434 | 2434 |
| 2435 | 2435 |
| 2436 void LCodeGen::DoLoadKeyedFastDoubleElement( | |
| 2437 LLoadKeyedFastDoubleElement* instr) { | |
| 2438 Register elements = ToRegister(instr->elements()); | |
| 2439 bool key_is_constant = instr->key()->IsConstantOperand(); | |
| 2440 Register key = no_reg; | |
| 2441 DwVfpRegister result = ToDoubleRegister(instr->result()); | |
| 2442 Register scratch1 = scratch0(); | |
|
Mads Ager (chromium)
2011/07/19 08:03:51
scratch1 -> scratch?
danno
2011/07/19 12:50:17
Done.
| |
| 2443 | |
| 2444 int shift_size = | |
| 2445 ElementsKindToShiftSize(JSObject::FAST_DOUBLE_ELEMENTS); | |
| 2446 int constant_key = 0; | |
| 2447 if (key_is_constant) { | |
| 2448 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | |
| 2449 if (constant_key & 0xF0000000) { | |
| 2450 Abort("array index constant value too big."); | |
| 2451 } | |
| 2452 } else { | |
| 2453 key = ToRegister(instr->key()); | |
| 2454 } | |
| 2455 | |
| 2456 Operand operand(key_is_constant ? Operand(constant_key * (1 << shift_size)) | |
|
Mads Ager (chromium)
2011/07/19 08:03:51
Use "operand = expression" instead of "operand(exp
danno
2011/07/19 12:50:17
Done.
| |
| 2457 : Operand(key, LSL, shift_size)); | |
| 2458 __ add(elements, elements, operand); | |
|
Alexandre
2011/07/18 16:22:14
If key is constant this add instruction can be mer
Mads Ager (chromium)
2011/07/19 08:03:51
I'm fine with tweaking stuff like this later. I th
danno
2011/07/19 12:50:17
Done.
| |
| 2459 | |
| 2460 if (instr->hydrogen()->RequiresHoleCheck()) { | |
| 2461 int offset = | |
| 2462 FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); | |
| 2463 __ ldr(scratch1, FieldMemOperand(elements, offset)); | |
| 2464 __ cmp(scratch1, Operand(kHoleNanUpper32)); | |
| 2465 DeoptimizeIf(eq, instr->environment()); | |
| 2466 } | |
| 2467 | |
| 2468 __ add(elements, elements, | |
| 2469 Operand(FixedDoubleArray::kHeaderSize - kSmiTagMask)); | |
|
Mads Ager (chromium)
2011/07/19 08:03:51
kSmiTagMask -> kHeapObjectTag?
danno
2011/07/19 12:50:17
Done.
| |
| 2470 __ vldr(result, elements, 0); | |
| 2471 } | |
| 2472 | |
| 2473 | |
| 2436 void LCodeGen::DoLoadKeyedSpecializedArrayElement( | 2474 void LCodeGen::DoLoadKeyedSpecializedArrayElement( |
| 2437 LLoadKeyedSpecializedArrayElement* instr) { | 2475 LLoadKeyedSpecializedArrayElement* instr) { |
| 2438 Register external_pointer = ToRegister(instr->external_pointer()); | 2476 Register external_pointer = ToRegister(instr->external_pointer()); |
| 2439 Register key = no_reg; | 2477 Register key = no_reg; |
| 2440 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 2478 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 2441 bool key_is_constant = instr->key()->IsConstantOperand(); | 2479 bool key_is_constant = instr->key()->IsConstantOperand(); |
| 2442 int constant_key = 0; | 2480 int constant_key = 0; |
| 2443 if (key_is_constant) { | 2481 if (key_is_constant) { |
| 2444 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | 2482 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
| 2445 if (constant_key & 0xF0000000) { | 2483 if (constant_key & 0xF0000000) { |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3236 } | 3274 } |
| 3237 | 3275 |
| 3238 if (instr->hydrogen()->NeedsWriteBarrier()) { | 3276 if (instr->hydrogen()->NeedsWriteBarrier()) { |
| 3239 // Compute address of modified element and store it into key register. | 3277 // Compute address of modified element and store it into key register. |
| 3240 __ add(key, scratch, Operand(FixedArray::kHeaderSize)); | 3278 __ add(key, scratch, Operand(FixedArray::kHeaderSize)); |
| 3241 __ RecordWrite(elements, key, value); | 3279 __ RecordWrite(elements, key, value); |
| 3242 } | 3280 } |
| 3243 } | 3281 } |
| 3244 | 3282 |
| 3245 | 3283 |
| 3284 void LCodeGen::DoStoreKeyedFastDoubleElement( | |
| 3285 LStoreKeyedFastDoubleElement* instr) { | |
| 3286 DwVfpRegister value = ToDoubleRegister(instr->value()); | |
| 3287 Register elements = ToRegister(instr->elements()); | |
| 3288 Register key = no_reg; | |
| 3289 bool key_is_constant = instr->key()->IsConstantOperand(); | |
| 3290 int constant_key = 0; | |
| 3291 Label not_nan; | |
| 3292 | |
| 3293 // Calculate the effective address of the slot in the array to store the | |
| 3294 // double value. | |
| 3295 if (key_is_constant) { | |
| 3296 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | |
| 3297 if (constant_key & 0xF0000000) { | |
| 3298 Abort("array index constant value too big."); | |
| 3299 } | |
| 3300 } else { | |
| 3301 key = ToRegister(instr->key()); | |
| 3302 } | |
| 3303 int shift_size = ElementsKindToShiftSize(JSObject::FAST_DOUBLE_ELEMENTS); | |
| 3304 Operand operand(key_is_constant ? Operand(constant_key * (1 << shift_size)) | |
|
Mads Ager (chromium)
2011/07/19 08:03:51
I would use '=' here.
danno
2011/07/19 12:50:17
Done.
| |
| 3305 : Operand(key, LSL, shift_size)); | |
| 3306 __ add(elements, elements, operand); | |
|
Alexandre
2011/07/18 16:22:14
If the key is constant, these two add instructions
Mads Ager (chromium)
2011/07/19 08:03:51
Instead of writing to elements here, can you use t
danno
2011/07/19 12:50:17
Done.
danno
2011/07/19 12:50:17
Done.
| |
| 3307 __ add(elements, elements, | |
| 3308 Operand(FixedDoubleArray::kHeaderSize - kSmiTagMask)); | |
|
Mads Ager (chromium)
2011/07/19 08:03:51
kHeapObjectTag
danno
2011/07/19 12:50:17
Done.
| |
| 3309 | |
| 3310 // Check for NaN. All NaNs must be canonicalized. | |
| 3311 __ VFPCompareAndSetFlags(value, value); | |
| 3312 __ b(vc, ¬_nan); | |
| 3313 | |
| 3314 __ Vmov(value, FixedDoubleArray::canonical_not_the_hole_nan_as_double()); | |
|
Alexandre
2011/07/18 16:22:14
You can spare the previous branch by making this v
danno
2011/07/19 12:50:17
Done.
| |
| 3315 | |
| 3316 __ bind(¬_nan); | |
| 3317 __ vstr(value, elements, 0); | |
| 3318 } | |
| 3319 | |
| 3320 | |
| 3246 void LCodeGen::DoStoreKeyedSpecializedArrayElement( | 3321 void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
| 3247 LStoreKeyedSpecializedArrayElement* instr) { | 3322 LStoreKeyedSpecializedArrayElement* instr) { |
| 3248 | 3323 |
| 3249 Register external_pointer = ToRegister(instr->external_pointer()); | 3324 Register external_pointer = ToRegister(instr->external_pointer()); |
| 3250 Register key = no_reg; | 3325 Register key = no_reg; |
| 3251 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 3326 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 3252 bool key_is_constant = instr->key()->IsConstantOperand(); | 3327 bool key_is_constant = instr->key()->IsConstantOperand(); |
| 3253 int constant_key = 0; | 3328 int constant_key = 0; |
| 3254 if (key_is_constant) { | 3329 if (key_is_constant) { |
| 3255 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | 3330 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
| (...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4400 ASSERT(osr_pc_offset_ == -1); | 4475 ASSERT(osr_pc_offset_ == -1); |
| 4401 osr_pc_offset_ = masm()->pc_offset(); | 4476 osr_pc_offset_ = masm()->pc_offset(); |
| 4402 } | 4477 } |
| 4403 | 4478 |
| 4404 | 4479 |
| 4405 | 4480 |
| 4406 | 4481 |
| 4407 #undef __ | 4482 #undef __ |
| 4408 | 4483 |
| 4409 } } // namespace v8::internal | 4484 } } // namespace v8::internal |
| OLD | NEW |