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

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

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

Powered by Google App Engine
This is Rietveld 408576698