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

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

Issue 7112010: Plumbing changes to merge various element kind implementaions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 years, 6 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/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('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 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after
2433 FixedArray::kHeaderSize)); 2433 FixedArray::kHeaderSize));
2434 2434
2435 // Check for the hole value. 2435 // Check for the hole value.
2436 if (instr->hydrogen()->RequiresHoleCheck()) { 2436 if (instr->hydrogen()->RequiresHoleCheck()) {
2437 __ cmp(result, factory()->the_hole_value()); 2437 __ cmp(result, factory()->the_hole_value());
2438 DeoptimizeIf(equal, instr->environment()); 2438 DeoptimizeIf(equal, instr->environment());
2439 } 2439 }
2440 } 2440 }
2441 2441
2442 2442
2443 Operand LCodeGen::BuildExternalArrayOperand(LOperand* external_pointer, 2443 Operand LCodeGen::BuildExternalArrayOperand(
2444 LOperand* key, 2444 LOperand* external_pointer,
2445 ExternalArrayType array_type) { 2445 LOperand* key,
2446 JSObject::ElementsKind elements_kind) {
2446 Register external_pointer_reg = ToRegister(external_pointer); 2447 Register external_pointer_reg = ToRegister(external_pointer);
2447 int shift_size = ExternalArrayTypeToShiftSize(array_type); 2448 int shift_size = ElementsKindToShiftSize(elements_kind);
2448 if (key->IsConstantOperand()) { 2449 if (key->IsConstantOperand()) {
2449 int constant_value = ToInteger32(LConstantOperand::cast(key)); 2450 int constant_value = ToInteger32(LConstantOperand::cast(key));
2450 if (constant_value & 0xF0000000) { 2451 if (constant_value & 0xF0000000) {
2451 Abort("array index constant value too big"); 2452 Abort("array index constant value too big");
2452 } 2453 }
2453 return Operand(external_pointer_reg, constant_value * (1 << shift_size)); 2454 return Operand(external_pointer_reg, constant_value * (1 << shift_size));
2454 } else { 2455 } else {
2455 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); 2456 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size);
2456 return Operand(external_pointer_reg, ToRegister(key), scale_factor, 0); 2457 return Operand(external_pointer_reg, ToRegister(key), scale_factor, 0);
2457 } 2458 }
2458 } 2459 }
2459 2460
2460 2461
2461 void LCodeGen::DoLoadKeyedSpecializedArrayElement( 2462 void LCodeGen::DoLoadKeyedSpecializedArrayElement(
2462 LLoadKeyedSpecializedArrayElement* instr) { 2463 LLoadKeyedSpecializedArrayElement* instr) {
2463 ExternalArrayType array_type = instr->array_type(); 2464 JSObject::ElementsKind elements_kind = instr->elements_kind();
2464 Operand operand(BuildExternalArrayOperand(instr->external_pointer(), 2465 Operand operand(BuildExternalArrayOperand(instr->external_pointer(),
2465 instr->key(), array_type)); 2466 instr->key(), elements_kind));
2466 if (array_type == kExternalFloatArray) { 2467 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) {
2467 XMMRegister result(ToDoubleRegister(instr->result())); 2468 XMMRegister result(ToDoubleRegister(instr->result()));
2468 __ movss(result, operand); 2469 __ movss(result, operand);
2469 __ cvtss2sd(result, result); 2470 __ cvtss2sd(result, result);
2470 } else if (array_type == kExternalDoubleArray) { 2471 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
2471 __ movdbl(ToDoubleRegister(instr->result()), operand); 2472 __ movdbl(ToDoubleRegister(instr->result()), operand);
2472 } else { 2473 } else {
2473 Register result(ToRegister(instr->result())); 2474 Register result(ToRegister(instr->result()));
2474 switch (array_type) { 2475 switch (elements_kind) {
2475 case kExternalByteArray: 2476 case JSObject::EXTERNAL_BYTE_ELEMENTS:
2476 __ movsx_b(result, operand); 2477 __ movsx_b(result, operand);
2477 break; 2478 break;
2478 case kExternalUnsignedByteArray: 2479 case JSObject::EXTERNAL_PIXEL_ELEMENTS:
2479 case kExternalPixelArray: 2480 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
2480 __ movzx_b(result, operand); 2481 __ movzx_b(result, operand);
2481 break; 2482 break;
2482 case kExternalShortArray: 2483 case JSObject::EXTERNAL_SHORT_ELEMENTS:
2483 __ movsx_w(result, operand); 2484 __ movsx_w(result, operand);
2484 break; 2485 break;
2485 case kExternalUnsignedShortArray: 2486 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
2486 __ movzx_w(result, operand); 2487 __ movzx_w(result, operand);
2487 break; 2488 break;
2488 case kExternalIntArray: 2489 case JSObject::EXTERNAL_INT_ELEMENTS:
2489 __ mov(result, operand); 2490 __ mov(result, operand);
2490 break; 2491 break;
2491 case kExternalUnsignedIntArray: 2492 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
2492 __ mov(result, operand); 2493 __ mov(result, operand);
2493 __ test(result, Operand(result)); 2494 __ test(result, Operand(result));
2494 // TODO(danno): we could be more clever here, perhaps having a special 2495 // TODO(danno): we could be more clever here, perhaps having a special
2495 // version of the stub that detects if the overflow case actually 2496 // version of the stub that detects if the overflow case actually
2496 // happens, and generate code that returns a double rather than int. 2497 // happens, and generate code that returns a double rather than int.
2497 DeoptimizeIf(negative, instr->environment()); 2498 DeoptimizeIf(negative, instr->environment());
2498 break; 2499 break;
2499 case kExternalFloatArray: 2500 case JSObject::EXTERNAL_FLOAT_ELEMENTS:
2500 case kExternalDoubleArray: 2501 case JSObject::EXTERNAL_DOUBLE_ELEMENTS:
2502 case JSObject::FAST_ELEMENTS:
2503 case JSObject::FAST_DOUBLE_ELEMENTS:
2504 case JSObject::DICTIONARY_ELEMENTS:
2501 UNREACHABLE(); 2505 UNREACHABLE();
2502 break; 2506 break;
2503 } 2507 }
2504 } 2508 }
2505 } 2509 }
2506 2510
2507 2511
2508 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { 2512 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2509 ASSERT(ToRegister(instr->context()).is(esi)); 2513 ASSERT(ToRegister(instr->context()).is(esi));
2510 ASSERT(ToRegister(instr->object()).is(edx)); 2514 ASSERT(ToRegister(instr->object()).is(edx));
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
3198 3202
3199 3203
3200 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 3204 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3201 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); 3205 __ cmp(ToRegister(instr->index()), ToOperand(instr->length()));
3202 DeoptimizeIf(above_equal, instr->environment()); 3206 DeoptimizeIf(above_equal, instr->environment());
3203 } 3207 }
3204 3208
3205 3209
3206 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 3210 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
3207 LStoreKeyedSpecializedArrayElement* instr) { 3211 LStoreKeyedSpecializedArrayElement* instr) {
3208 ExternalArrayType array_type = instr->array_type(); 3212 JSObject::ElementsKind elements_kind = instr->elements_kind();
3209 Operand operand(BuildExternalArrayOperand(instr->external_pointer(), 3213 Operand operand(BuildExternalArrayOperand(instr->external_pointer(),
3210 instr->key(), array_type)); 3214 instr->key(), elements_kind));
3211 if (array_type == kExternalFloatArray) { 3215 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) {
3212 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value())); 3216 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value()));
3213 __ movss(operand, xmm0); 3217 __ movss(operand, xmm0);
3214 } else if (array_type == kExternalDoubleArray) { 3218 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
3215 __ movdbl(operand, ToDoubleRegister(instr->value())); 3219 __ movdbl(operand, ToDoubleRegister(instr->value()));
3216 } else { 3220 } else {
3217 Register value = ToRegister(instr->value()); 3221 Register value = ToRegister(instr->value());
3218 switch (array_type) { 3222 switch (elements_kind) {
3219 case kExternalPixelArray: 3223 case JSObject::EXTERNAL_PIXEL_ELEMENTS:
3220 case kExternalByteArray: 3224 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3221 case kExternalUnsignedByteArray: 3225 case JSObject::EXTERNAL_BYTE_ELEMENTS:
3222 __ mov_b(operand, value); 3226 __ mov_b(operand, value);
3223 break; 3227 break;
3224 case kExternalShortArray: 3228 case JSObject::EXTERNAL_SHORT_ELEMENTS:
3225 case kExternalUnsignedShortArray: 3229 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3226 __ mov_w(operand, value); 3230 __ mov_w(operand, value);
3227 break; 3231 break;
3228 case kExternalIntArray: 3232 case JSObject::EXTERNAL_INT_ELEMENTS:
3229 case kExternalUnsignedIntArray: 3233 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
3230 __ mov(operand, value); 3234 __ mov(operand, value);
3231 break; 3235 break;
3232 case kExternalFloatArray: 3236 case JSObject::EXTERNAL_FLOAT_ELEMENTS:
3233 case kExternalDoubleArray: 3237 case JSObject::EXTERNAL_DOUBLE_ELEMENTS:
3238 case JSObject::FAST_ELEMENTS:
3239 case JSObject::FAST_DOUBLE_ELEMENTS:
3240 case JSObject::DICTIONARY_ELEMENTS:
3234 UNREACHABLE(); 3241 UNREACHABLE();
3235 break; 3242 break;
3236 } 3243 }
3237 } 3244 }
3238 } 3245 }
3239 3246
3240 3247
3241 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { 3248 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
3242 Register value = ToRegister(instr->value()); 3249 Register value = ToRegister(instr->value());
3243 Register elements = ToRegister(instr->object()); 3250 Register elements = ToRegister(instr->object());
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
4444 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 4451 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
4445 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4452 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4446 } 4453 }
4447 4454
4448 4455
4449 #undef __ 4456 #undef __
4450 4457
4451 } } // namespace v8::internal 4458 } } // namespace v8::internal
4452 4459
4453 #endif // V8_TARGET_ARCH_IA32 4460 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698