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

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

Issue 12114054: Supporting AllocationSiteInfo for Nested arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Now with ports to arm and x64 Created 7 years, 10 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
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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 398 }
399 ASSERT(i == elements_size); 399 ASSERT(i == elements_size);
400 } 400 }
401 } 401 }
402 } 402 }
403 403
404 404
405 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { 405 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) {
406 // Stack layout on entry: 406 // Stack layout on entry:
407 // 407 //
408 // [esp + kPointerSize]: constant elements. 408 // [esp + kPointerSize]: flags (ignored)
409 // [esp + (2 * kPointerSize)]: literal index. 409 // [esp + (2 * kPointerSize)]: constant elements.
410 // [esp + (3 * kPointerSize)]: literals array. 410 // [esp + (3 * kPointerSize)]: literal index.
411 // [esp + (4 * kPointerSize)]: literals array.
411 412
412 // Load boilerplate object into ecx and check if we need to create a 413 // Load boilerplate object into ecx and check if we need to create a
413 // boilerplate. 414 // boilerplate.
414 __ mov(ecx, Operand(esp, 3 * kPointerSize)); 415 __ mov(ecx, Operand(esp, 4 * kPointerSize));
415 __ mov(eax, Operand(esp, 2 * kPointerSize)); 416 __ mov(eax, Operand(esp, 3 * kPointerSize));
416 STATIC_ASSERT(kPointerSize == 4); 417 STATIC_ASSERT(kPointerSize == 4);
417 STATIC_ASSERT(kSmiTagSize == 1); 418 STATIC_ASSERT(kSmiTagSize == 1);
418 STATIC_ASSERT(kSmiTag == 0); 419 STATIC_ASSERT(kSmiTag == 0);
419 __ mov(ecx, FieldOperand(ecx, eax, times_half_pointer_size, 420 __ mov(ecx, FieldOperand(ecx, eax, times_half_pointer_size,
420 FixedArray::kHeaderSize)); 421 FixedArray::kHeaderSize));
421 Factory* factory = masm->isolate()->factory(); 422 Factory* factory = masm->isolate()->factory();
422 __ cmp(ecx, factory->undefined_value()); 423 __ cmp(ecx, factory->undefined_value());
423 Label slow_case; 424 Label slow_case;
424 __ j(equal, &slow_case); 425 __ j(equal, &slow_case);
425 426
426 FastCloneShallowArrayStub::Mode mode = mode_; 427 FastCloneShallowArrayStub::Mode mode = mode_;
427 // ecx is boilerplate object. 428 // ecx is boilerplate object.
428 if (mode == CLONE_ANY_ELEMENTS) { 429 if (mode == CLONE_ANY_ELEMENTS) {
429 Label double_elements, check_fast_elements; 430 Label double_elements, check_fast_elements;
430 __ mov(ebx, FieldOperand(ecx, JSArray::kElementsOffset)); 431 __ mov(ebx, FieldOperand(ecx, JSArray::kElementsOffset));
431 __ CheckMap(ebx, factory->fixed_cow_array_map(), 432 __ CheckMap(ebx, factory->fixed_cow_array_map(),
432 &check_fast_elements, DONT_DO_SMI_CHECK); 433 &check_fast_elements, DONT_DO_SMI_CHECK);
433 GenerateFastCloneShallowArrayCommon(masm, 0, COPY_ON_WRITE_ELEMENTS, 434 GenerateFastCloneShallowArrayCommon(masm, 0, COPY_ON_WRITE_ELEMENTS,
434 allocation_site_mode_, 435 allocation_site_mode_,
435 &slow_case); 436 &slow_case);
436 __ ret(3 * kPointerSize); 437 __ ret(4 * kPointerSize);
437 438
438 __ bind(&check_fast_elements); 439 __ bind(&check_fast_elements);
439 __ CheckMap(ebx, factory->fixed_array_map(), 440 __ CheckMap(ebx, factory->fixed_array_map(),
440 &double_elements, DONT_DO_SMI_CHECK); 441 &double_elements, DONT_DO_SMI_CHECK);
441 GenerateFastCloneShallowArrayCommon(masm, length_, CLONE_ELEMENTS, 442 GenerateFastCloneShallowArrayCommon(masm, length_, CLONE_ELEMENTS,
442 allocation_site_mode_, 443 allocation_site_mode_,
443 &slow_case); 444 &slow_case);
444 __ ret(3 * kPointerSize); 445 __ ret(4 * kPointerSize);
445 446
446 __ bind(&double_elements); 447 __ bind(&double_elements);
447 mode = CLONE_DOUBLE_ELEMENTS; 448 mode = CLONE_DOUBLE_ELEMENTS;
448 // Fall through to generate the code to handle double elements. 449 // Fall through to generate the code to handle double elements.
449 } 450 }
450 451
451 if (FLAG_debug_code) { 452 if (FLAG_debug_code) {
452 const char* message; 453 const char* message;
453 Handle<Map> expected_map; 454 Handle<Map> expected_map;
454 if (mode == CLONE_ELEMENTS) { 455 if (mode == CLONE_ELEMENTS) {
(...skipping 12 matching lines...) Expand all
467 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), expected_map); 468 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), expected_map);
468 __ Assert(equal, message); 469 __ Assert(equal, message);
469 __ pop(ecx); 470 __ pop(ecx);
470 } 471 }
471 472
472 GenerateFastCloneShallowArrayCommon(masm, length_, mode, 473 GenerateFastCloneShallowArrayCommon(masm, length_, mode,
473 allocation_site_mode_, 474 allocation_site_mode_,
474 &slow_case); 475 &slow_case);
475 476
476 // Return and remove the on-stack parameters. 477 // Return and remove the on-stack parameters.
477 __ ret(3 * kPointerSize); 478 __ ret(4 * kPointerSize);
478 479
479 __ bind(&slow_case); 480 __ bind(&slow_case);
480 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); 481 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 4, 1);
481 } 482 }
482 483
483 484
484 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) { 485 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) {
485 // Stack layout on entry: 486 // Stack layout on entry:
486 // 487 //
487 // [esp + kPointerSize]: object literal flags. 488 // [esp + kPointerSize]: object literal flags.
488 // [esp + (2 * kPointerSize)]: constant properties. 489 // [esp + (2 * kPointerSize)]: constant properties.
489 // [esp + (3 * kPointerSize)]: literal index. 490 // [esp + (3 * kPointerSize)]: literal index.
490 // [esp + (4 * kPointerSize)]: literals array. 491 // [esp + (4 * kPointerSize)]: literals array.
(...skipping 7177 matching lines...) Expand 10 before | Expand all | Expand 10 after
7668 // Restore ecx. 7669 // Restore ecx.
7669 __ pop(ecx); 7670 __ pop(ecx);
7670 __ ret(0); 7671 __ ret(0);
7671 } 7672 }
7672 7673
7673 #undef __ 7674 #undef __
7674 7675
7675 } } // namespace v8::internal 7676 } } // namespace v8::internal
7676 7677
7677 #endif // V8_TARGET_ARCH_IA32 7678 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698