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

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

Issue 101413006: Implement in-heap backing store for typed arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Self-review Created 7 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2294 } 2294 }
2295 2295
2296 2296
2297 LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) { 2297 LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) {
2298 ElementsKind elements_kind = instr->elements_kind(); 2298 ElementsKind elements_kind = instr->elements_kind();
2299 2299
2300 // Determine if we need a byte register in this case for the value. 2300 // Determine if we need a byte register in this case for the value.
2301 bool val_is_fixed_register = 2301 bool val_is_fixed_register =
2302 elements_kind == EXTERNAL_BYTE_ELEMENTS || 2302 elements_kind == EXTERNAL_BYTE_ELEMENTS ||
2303 elements_kind == EXTERNAL_UNSIGNED_BYTE_ELEMENTS || 2303 elements_kind == EXTERNAL_UNSIGNED_BYTE_ELEMENTS ||
2304 elements_kind == EXTERNAL_PIXEL_ELEMENTS; 2304 elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
2305 elements_kind == UINT8_ELEMENTS ||
2306 elements_kind == INT8_ELEMENTS ||
2307 elements_kind == UINT8_CLAMPED_ELEMENTS;
2305 if (val_is_fixed_register) { 2308 if (val_is_fixed_register) {
2306 return UseFixed(instr->value(), eax); 2309 return UseFixed(instr->value(), eax);
2307 } 2310 }
2308 2311
2309 if (!CpuFeatures::IsSafeForSnapshot(SSE2) && 2312 if (!CpuFeatures::IsSafeForSnapshot(SSE2) &&
2310 IsDoubleOrFloatElementsKind(elements_kind)) { 2313 IsDoubleOrFloatElementsKind(elements_kind)) {
2311 return UseRegisterAtStart(instr->value()); 2314 return UseRegisterAtStart(instr->value());
2312 } 2315 }
2313 2316
2314 return UseRegister(instr->value()); 2317 return UseRegister(instr->value());
2315 } 2318 }
2316 2319
2317 2320
2318 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { 2321 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2319 if (!instr->is_external()) { 2322 if (!instr->is_external() && !instr->is_fixed_typed_array()) {
2320 ASSERT(instr->elements()->representation().IsTagged()); 2323 ASSERT(instr->elements()->representation().IsTagged());
2321 ASSERT(instr->key()->representation().IsInteger32() || 2324 ASSERT(instr->key()->representation().IsInteger32() ||
2322 instr->key()->representation().IsSmi()); 2325 instr->key()->representation().IsSmi());
2323 2326
2324 if (instr->value()->representation().IsDouble()) { 2327 if (instr->value()->representation().IsDouble()) {
2325 LOperand* object = UseRegisterAtStart(instr->elements()); 2328 LOperand* object = UseRegisterAtStart(instr->elements());
2326 LOperand* val = NULL; 2329 LOperand* val = NULL;
2327 val = UseRegisterAtStart(instr->value()); 2330 val = UseRegisterAtStart(instr->value());
2328 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 2331 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2329 return new(zone()) LStoreKeyed(object, key, val); 2332 return new(zone()) LStoreKeyed(object, key, val);
(...skipping 11 matching lines...) Expand all
2341 val = UseRegisterOrConstantAtStart(instr->value()); 2344 val = UseRegisterOrConstantAtStart(instr->value());
2342 key = UseRegisterOrConstantAtStart(instr->key()); 2345 key = UseRegisterOrConstantAtStart(instr->key());
2343 } 2346 }
2344 return new(zone()) LStoreKeyed(obj, key, val); 2347 return new(zone()) LStoreKeyed(obj, key, val);
2345 } 2348 }
2346 } 2349 }
2347 2350
2348 ElementsKind elements_kind = instr->elements_kind(); 2351 ElementsKind elements_kind = instr->elements_kind();
2349 ASSERT( 2352 ASSERT(
2350 (instr->value()->representation().IsInteger32() && 2353 (instr->value()->representation().IsInteger32() &&
2351 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 2354 !IsDoubleOrFloatElementsKind(elements_kind)) ||
2352 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
2353 (instr->value()->representation().IsDouble() && 2355 (instr->value()->representation().IsDouble() &&
2354 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 2356 IsDoubleOrFloatElementsKind(elements_kind)));
2355 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 2357 ASSERT((instr->is_fixed_typed_array() &&
2356 ASSERT(instr->elements()->representation().IsExternal()); 2358 instr->elements()->representation().IsTagged()) ||
Toon Verwaest 2013/12/23 10:40:32 Align the instr at the same level of indentation.
Dmitry Lomov (no reviews) 2014/01/07 15:48:43 Done.
2359 (instr->is_external() &&
2360 instr->elements()->representation().IsExternal()));
2357 2361
2358 LOperand* external_pointer = UseRegister(instr->elements()); 2362 LOperand* backing_store = UseRegister(instr->elements());
2359 LOperand* val = GetStoreKeyedValueOperand(instr); 2363 LOperand* val = GetStoreKeyedValueOperand(instr);
2360 bool clobbers_key = ExternalArrayOpRequiresTemp( 2364 bool clobbers_key = ExternalArrayOpRequiresTemp(
2361 instr->key()->representation(), elements_kind); 2365 instr->key()->representation(), elements_kind);
2362 LOperand* key = clobbers_key 2366 LOperand* key = clobbers_key
2363 ? UseTempRegister(instr->key()) 2367 ? UseTempRegister(instr->key())
2364 : UseRegisterOrConstantAtStart(instr->key()); 2368 : UseRegisterOrConstantAtStart(instr->key());
2365 return new(zone()) LStoreKeyed(external_pointer, 2369 return new(zone()) LStoreKeyed(backing_store,
Toon Verwaest 2013/12/23 10:40:32 I'd put backing_store, key, val); on a single line
Dmitry Lomov (no reviews) 2014/01/07 15:48:43 Done.
2366 key, 2370 key,
2367 val); 2371 val);
2368 } 2372 }
2369 2373
2370 2374
2371 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 2375 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2372 LOperand* context = UseFixed(instr->context(), esi); 2376 LOperand* context = UseFixed(instr->context(), esi);
2373 LOperand* object = UseFixed(instr->object(), edx); 2377 LOperand* object = UseFixed(instr->object(), edx);
2374 LOperand* key = UseFixed(instr->key(), ecx); 2378 LOperand* key = UseFixed(instr->key(), ecx);
2375 LOperand* value = UseFixed(instr->value(), eax); 2379 LOperand* value = UseFixed(instr->value(), eax);
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2768 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2765 LOperand* object = UseRegister(instr->object()); 2769 LOperand* object = UseRegister(instr->object());
2766 LOperand* index = UseTempRegister(instr->index()); 2770 LOperand* index = UseTempRegister(instr->index());
2767 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2771 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2768 } 2772 }
2769 2773
2770 2774
2771 } } // namespace v8::internal 2775 } } // namespace v8::internal
2772 2776
2773 #endif // V8_TARGET_ARCH_IA32 2777 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698