Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 7350021: Crankshaft support for FixedDoubleArrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 scratch = scratch0();
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
2457 ? Operand(constant_key * (1 << shift_size) +
2458 FixedDoubleArray::kHeaderSize - kHeapObjectTag)
2459 : Operand(key, LSL, shift_size);
2460 __ add(elements, elements, operand);
2461 if (!key_is_constant) {
2462 __ add(elements, elements,
2463 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag));
2464 }
2465
2466 if (instr->hydrogen()->RequiresHoleCheck()) {
2467 // TODO(danno): If no hole check is required, there is no need to allocate
2468 // elements into a temporary register, instead scratch can be used.
2469 __ ldr(scratch, MemOperand(elements, sizeof(kHoleNanLower32)));
2470 __ cmp(scratch, Operand(kHoleNanUpper32));
2471 DeoptimizeIf(eq, instr->environment());
2472 }
2473
2474 __ vldr(result, elements, 0);
2475 }
2476
2477
2436 void LCodeGen::DoLoadKeyedSpecializedArrayElement( 2478 void LCodeGen::DoLoadKeyedSpecializedArrayElement(
2437 LLoadKeyedSpecializedArrayElement* instr) { 2479 LLoadKeyedSpecializedArrayElement* instr) {
2438 Register external_pointer = ToRegister(instr->external_pointer()); 2480 Register external_pointer = ToRegister(instr->external_pointer());
2439 Register key = no_reg; 2481 Register key = no_reg;
2440 JSObject::ElementsKind elements_kind = instr->elements_kind(); 2482 JSObject::ElementsKind elements_kind = instr->elements_kind();
2441 bool key_is_constant = instr->key()->IsConstantOperand(); 2483 bool key_is_constant = instr->key()->IsConstantOperand();
2442 int constant_key = 0; 2484 int constant_key = 0;
2443 if (key_is_constant) { 2485 if (key_is_constant) {
2444 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 2486 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
2445 if (constant_key & 0xF0000000) { 2487 if (constant_key & 0xF0000000) {
2446 Abort("array index constant value too big."); 2488 Abort("array index constant value too big.");
2447 } 2489 }
2448 } else { 2490 } else {
2449 key = ToRegister(instr->key()); 2491 key = ToRegister(instr->key());
2450 } 2492 }
2451 int shift_size = ElementsKindToShiftSize(elements_kind); 2493 int shift_size = ElementsKindToShiftSize(elements_kind);
2452 2494
2453 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS || 2495 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS ||
2454 elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 2496 elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
2455 CpuFeatures::Scope scope(VFP3); 2497 CpuFeatures::Scope scope(VFP3);
2456 DwVfpRegister result(ToDoubleRegister(instr->result())); 2498 DwVfpRegister result = ToDoubleRegister(instr->result());
2457 Operand operand(key_is_constant ? Operand(constant_key * (1 << shift_size)) 2499 Operand operand = key_is_constant
2458 : Operand(key, LSL, shift_size)); 2500 ? Operand(constant_key * (1 << shift_size))
2501 : Operand(key, LSL, shift_size);
2459 __ add(scratch0(), external_pointer, operand); 2502 __ add(scratch0(), external_pointer, operand);
2460 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { 2503 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) {
2461 __ vldr(result.low(), scratch0(), 0); 2504 __ vldr(result.low(), scratch0(), 0);
2462 __ vcvt_f64_f32(result, result.low()); 2505 __ vcvt_f64_f32(result, result.low());
2463 } else { // i.e. elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS 2506 } else { // i.e. elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS
2464 __ vldr(result, scratch0(), 0); 2507 __ vldr(result, scratch0(), 0);
2465 } 2508 }
2466 } else { 2509 } else {
2467 Register result(ToRegister(instr->result())); 2510 Register result = ToRegister(instr->result());
2468 MemOperand mem_operand(key_is_constant 2511 MemOperand mem_operand(key_is_constant
2469 ? MemOperand(external_pointer, constant_key * (1 << shift_size)) 2512 ? MemOperand(external_pointer, constant_key * (1 << shift_size))
2470 : MemOperand(external_pointer, key, LSL, shift_size)); 2513 : MemOperand(external_pointer, key, LSL, shift_size));
2471 switch (elements_kind) { 2514 switch (elements_kind) {
2472 case JSObject::EXTERNAL_BYTE_ELEMENTS: 2515 case JSObject::EXTERNAL_BYTE_ELEMENTS:
2473 __ ldrsb(result, mem_operand); 2516 __ ldrsb(result, mem_operand);
2474 break; 2517 break;
2475 case JSObject::EXTERNAL_PIXEL_ELEMENTS: 2518 case JSObject::EXTERNAL_PIXEL_ELEMENTS:
2476 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 2519 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
2477 __ ldrb(result, mem_operand); 2520 __ ldrb(result, mem_operand);
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
3236 } 3279 }
3237 3280
3238 if (instr->hydrogen()->NeedsWriteBarrier()) { 3281 if (instr->hydrogen()->NeedsWriteBarrier()) {
3239 // Compute address of modified element and store it into key register. 3282 // Compute address of modified element and store it into key register.
3240 __ add(key, scratch, Operand(FixedArray::kHeaderSize)); 3283 __ add(key, scratch, Operand(FixedArray::kHeaderSize));
3241 __ RecordWrite(elements, key, value); 3284 __ RecordWrite(elements, key, value);
3242 } 3285 }
3243 } 3286 }
3244 3287
3245 3288
3289 void LCodeGen::DoStoreKeyedFastDoubleElement(
3290 LStoreKeyedFastDoubleElement* instr) {
3291 DwVfpRegister value = ToDoubleRegister(instr->value());
3292 Register elements = ToRegister(instr->elements());
3293 Register key = no_reg;
3294 Register scratch = scratch0();
3295 bool key_is_constant = instr->key()->IsConstantOperand();
3296 int constant_key = 0;
3297 Label not_nan;
3298
3299 // Calculate the effective address of the slot in the array to store the
3300 // double value.
3301 if (key_is_constant) {
3302 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3303 if (constant_key & 0xF0000000) {
3304 Abort("array index constant value too big.");
3305 }
3306 } else {
3307 key = ToRegister(instr->key());
3308 }
3309 int shift_size = ElementsKindToShiftSize(JSObject::FAST_DOUBLE_ELEMENTS);
3310 Operand operand = key_is_constant
3311 ? Operand(constant_key * (1 << shift_size) +
3312 FixedDoubleArray::kHeaderSize - kHeapObjectTag)
3313 : Operand(key, LSL, shift_size);
3314 __ add(scratch, elements, operand);
3315 if (!key_is_constant) {
3316 __ add(scratch, scratch,
3317 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag));
3318 }
3319
3320 // Check for NaN. All NaNs must be canonicalized.
3321 __ VFPCompareAndSetFlags(value, value);
3322
3323 // Only load canonical NaN if the comparison above set the overflow.
3324 __ Vmov(value, FixedDoubleArray::canonical_not_the_hole_nan_as_double(), vs);
3325
3326 __ bind(&not_nan);
3327 __ vstr(value, scratch, 0);
3328 }
3329
3330
3246 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 3331 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
3247 LStoreKeyedSpecializedArrayElement* instr) { 3332 LStoreKeyedSpecializedArrayElement* instr) {
3248 3333
3249 Register external_pointer = ToRegister(instr->external_pointer()); 3334 Register external_pointer = ToRegister(instr->external_pointer());
3250 Register key = no_reg; 3335 Register key = no_reg;
3251 JSObject::ElementsKind elements_kind = instr->elements_kind(); 3336 JSObject::ElementsKind elements_kind = instr->elements_kind();
3252 bool key_is_constant = instr->key()->IsConstantOperand(); 3337 bool key_is_constant = instr->key()->IsConstantOperand();
3253 int constant_key = 0; 3338 int constant_key = 0;
3254 if (key_is_constant) { 3339 if (key_is_constant) {
3255 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 3340 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
4400 ASSERT(osr_pc_offset_ == -1); 4485 ASSERT(osr_pc_offset_ == -1);
4401 osr_pc_offset_ = masm()->pc_offset(); 4486 osr_pc_offset_ = masm()->pc_offset();
4402 } 4487 }
4403 4488
4404 4489
4405 4490
4406 4491
4407 #undef __ 4492 #undef __
4408 4493
4409 } } // namespace v8::internal 4494 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698