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

Side by Side Diff: src/code-stubs.cc

Issue 10170030: Implement tracking and optimizations of packed arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 7 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/builtins.cc ('k') | src/codegen.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 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 Handle<FixedArray> handler_table = 255 Handle<FixedArray> handler_table =
256 code->GetIsolate()->factory()->NewFixedArray(1, TENURED); 256 code->GetIsolate()->factory()->NewFixedArray(1, TENURED);
257 handler_table->set(0, Smi::FromInt(handler_offset_)); 257 handler_table->set(0, Smi::FromInt(handler_offset_));
258 code->set_handler_table(*handler_table); 258 code->set_handler_table(*handler_table);
259 } 259 }
260 260
261 261
262 void KeyedLoadElementStub::Generate(MacroAssembler* masm) { 262 void KeyedLoadElementStub::Generate(MacroAssembler* masm) {
263 switch (elements_kind_) { 263 switch (elements_kind_) {
264 case FAST_ELEMENTS: 264 case FAST_ELEMENTS:
265 case FAST_SMI_ONLY_ELEMENTS: 265 case FAST_HOLEY_ELEMENTS:
266 case FAST_SMI_ELEMENTS:
267 case FAST_HOLEY_SMI_ELEMENTS:
266 KeyedLoadStubCompiler::GenerateLoadFastElement(masm); 268 KeyedLoadStubCompiler::GenerateLoadFastElement(masm);
267 break; 269 break;
268 case FAST_DOUBLE_ELEMENTS: 270 case FAST_DOUBLE_ELEMENTS:
271 case FAST_HOLEY_DOUBLE_ELEMENTS:
269 KeyedLoadStubCompiler::GenerateLoadFastDoubleElement(masm); 272 KeyedLoadStubCompiler::GenerateLoadFastDoubleElement(masm);
270 break; 273 break;
271 case EXTERNAL_BYTE_ELEMENTS: 274 case EXTERNAL_BYTE_ELEMENTS:
272 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 275 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
273 case EXTERNAL_SHORT_ELEMENTS: 276 case EXTERNAL_SHORT_ELEMENTS:
274 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 277 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
275 case EXTERNAL_INT_ELEMENTS: 278 case EXTERNAL_INT_ELEMENTS:
276 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 279 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
277 case EXTERNAL_FLOAT_ELEMENTS: 280 case EXTERNAL_FLOAT_ELEMENTS:
278 case EXTERNAL_DOUBLE_ELEMENTS: 281 case EXTERNAL_DOUBLE_ELEMENTS:
279 case EXTERNAL_PIXEL_ELEMENTS: 282 case EXTERNAL_PIXEL_ELEMENTS:
280 KeyedLoadStubCompiler::GenerateLoadExternalArray(masm, elements_kind_); 283 KeyedLoadStubCompiler::GenerateLoadExternalArray(masm, elements_kind_);
281 break; 284 break;
282 case DICTIONARY_ELEMENTS: 285 case DICTIONARY_ELEMENTS:
283 KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm); 286 KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm);
284 break; 287 break;
285 case NON_STRICT_ARGUMENTS_ELEMENTS: 288 case NON_STRICT_ARGUMENTS_ELEMENTS:
286 UNREACHABLE(); 289 UNREACHABLE();
287 break; 290 break;
288 } 291 }
289 } 292 }
290 293
291 294
292 void KeyedStoreElementStub::Generate(MacroAssembler* masm) { 295 void KeyedStoreElementStub::Generate(MacroAssembler* masm) {
293 switch (elements_kind_) { 296 switch (elements_kind_) {
294 case FAST_ELEMENTS: 297 case FAST_ELEMENTS:
295 case FAST_SMI_ONLY_ELEMENTS: { 298 case FAST_HOLEY_ELEMENTS:
299 case FAST_SMI_ELEMENTS:
300 case FAST_HOLEY_SMI_ELEMENTS: {
296 KeyedStoreStubCompiler::GenerateStoreFastElement(masm, 301 KeyedStoreStubCompiler::GenerateStoreFastElement(masm,
297 is_js_array_, 302 is_js_array_,
298 elements_kind_, 303 elements_kind_,
299 grow_mode_); 304 grow_mode_);
300 } 305 }
301 break; 306 break;
302 case FAST_DOUBLE_ELEMENTS: 307 case FAST_DOUBLE_ELEMENTS:
308 case FAST_HOLEY_DOUBLE_ELEMENTS:
303 KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(masm, 309 KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(masm,
304 is_js_array_, 310 is_js_array_,
305 grow_mode_); 311 grow_mode_);
306 break; 312 break;
307 case EXTERNAL_BYTE_ELEMENTS: 313 case EXTERNAL_BYTE_ELEMENTS:
308 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 314 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
309 case EXTERNAL_SHORT_ELEMENTS: 315 case EXTERNAL_SHORT_ELEMENTS:
310 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 316 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
311 case EXTERNAL_INT_ELEMENTS: 317 case EXTERNAL_INT_ELEMENTS:
312 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 318 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 429
424 430
425 bool ToBooleanStub::Types::CanBeUndetectable() const { 431 bool ToBooleanStub::Types::CanBeUndetectable() const {
426 return Contains(ToBooleanStub::SPEC_OBJECT) 432 return Contains(ToBooleanStub::SPEC_OBJECT)
427 || Contains(ToBooleanStub::STRING); 433 || Contains(ToBooleanStub::STRING);
428 } 434 }
429 435
430 436
431 void ElementsTransitionAndStoreStub::Generate(MacroAssembler* masm) { 437 void ElementsTransitionAndStoreStub::Generate(MacroAssembler* masm) {
432 Label fail; 438 Label fail;
439 ASSERT(!IsFastHoleyElementsKind(from_) || IsFastHoleyElementsKind(to_));
433 if (!FLAG_trace_elements_transitions) { 440 if (!FLAG_trace_elements_transitions) {
434 if (to_ == FAST_ELEMENTS) { 441 if (IsFastSmiOrObjectElementsKind(to_)) {
435 if (from_ == FAST_SMI_ONLY_ELEMENTS) { 442 if (IsFastSmiOrObjectElementsKind(from_)) {
436 ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm); 443 ElementsTransitionGenerator::
437 } else if (from_ == FAST_DOUBLE_ELEMENTS) { 444 GenerateMapChangeElementsTransition(masm);
445 } else if (IsFastDoubleElementsKind(from_)) {
446 ASSERT(!IsFastSmiElementsKind(to_));
438 ElementsTransitionGenerator::GenerateDoubleToObject(masm, &fail); 447 ElementsTransitionGenerator::GenerateDoubleToObject(masm, &fail);
439 } else { 448 } else {
440 UNREACHABLE(); 449 UNREACHABLE();
441 } 450 }
442 KeyedStoreStubCompiler::GenerateStoreFastElement(masm, 451 KeyedStoreStubCompiler::GenerateStoreFastElement(masm,
443 is_jsarray_, 452 is_jsarray_,
444 FAST_ELEMENTS, 453 to_,
445 grow_mode_); 454 grow_mode_);
446 } else if (from_ == FAST_SMI_ONLY_ELEMENTS && to_ == FAST_DOUBLE_ELEMENTS) { 455 } else if (IsFastSmiElementsKind(from_) &&
447 ElementsTransitionGenerator::GenerateSmiOnlyToDouble(masm, &fail); 456 IsFastDoubleElementsKind(to_)) {
457 ElementsTransitionGenerator::GenerateSmiToDouble(masm, &fail);
448 KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(masm, 458 KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(masm,
449 is_jsarray_, 459 is_jsarray_,
450 grow_mode_); 460 grow_mode_);
461 } else if (IsFastDoubleElementsKind(from_)) {
462 ASSERT(to_ == FAST_HOLEY_DOUBLE_ELEMENTS);
463 ElementsTransitionGenerator::
464 GenerateMapChangeElementsTransition(masm);
451 } else { 465 } else {
452 UNREACHABLE(); 466 UNREACHABLE();
453 } 467 }
454 } 468 }
455 masm->bind(&fail); 469 masm->bind(&fail);
456 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode_); 470 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode_);
457 } 471 }
458 472
459 } } // namespace v8::internal 473 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698