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

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

Issue 140963004: Array constructor shouldn't require a Cell, just an AllocationSite. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code comments. Created 6 years, 11 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/code-stubs-hydrogen.cc ('k') | src/mips/code-stubs-mips.cc » ('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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 185
186 186
187 static void InitializeArrayConstructorDescriptor( 187 static void InitializeArrayConstructorDescriptor(
188 Isolate* isolate, 188 Isolate* isolate,
189 CodeStubInterfaceDescriptor* descriptor, 189 CodeStubInterfaceDescriptor* descriptor,
190 int constant_stack_parameter_count) { 190 int constant_stack_parameter_count) {
191 // register state 191 // register state
192 // eax -- number of arguments 192 // eax -- number of arguments
193 // edi -- function 193 // edi -- function
194 // ebx -- type info cell with elements kind 194 // ebx -- allocation site with elements kind
195 static Register registers_variable_args[] = { edi, ebx, eax }; 195 static Register registers_variable_args[] = { edi, ebx, eax };
196 static Register registers_no_args[] = { edi, ebx }; 196 static Register registers_no_args[] = { edi, ebx };
197 197
198 if (constant_stack_parameter_count == 0) { 198 if (constant_stack_parameter_count == 0) {
199 descriptor->register_param_count_ = 2; 199 descriptor->register_param_count_ = 2;
200 descriptor->register_params_ = registers_no_args; 200 descriptor->register_params_ = registers_no_args;
201 } else { 201 } else {
202 // stack param count needs (constructor pointer, and single argument) 202 // stack param count needs (constructor pointer, and single argument)
203 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; 203 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS;
204 descriptor->stack_parameter_count_ = eax; 204 descriptor->stack_parameter_count_ = eax;
(...skipping 5219 matching lines...) Expand 10 before | Expand all | Expand 10 after
5424 // If we reached this point there is a problem. 5424 // If we reached this point there is a problem.
5425 __ Abort(kUnexpectedElementsKindInArrayConstructor); 5425 __ Abort(kUnexpectedElementsKindInArrayConstructor);
5426 } else { 5426 } else {
5427 UNREACHABLE(); 5427 UNREACHABLE();
5428 } 5428 }
5429 } 5429 }
5430 5430
5431 5431
5432 static void CreateArrayDispatchOneArgument(MacroAssembler* masm, 5432 static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
5433 AllocationSiteOverrideMode mode) { 5433 AllocationSiteOverrideMode mode) {
5434 // ebx - type info cell (if mode != DISABLE_ALLOCATION_SITES) 5434 // ebx - allocation site (if mode != DISABLE_ALLOCATION_SITES)
5435 // edx - kind (if mode != DISABLE_ALLOCATION_SITES) 5435 // edx - kind (if mode != DISABLE_ALLOCATION_SITES)
5436 // eax - number of arguments 5436 // eax - number of arguments
5437 // edi - constructor? 5437 // edi - constructor?
5438 // esp[0] - return address 5438 // esp[0] - return address
5439 // esp[4] - last argument 5439 // esp[4] - last argument
5440 Label normal_sequence; 5440 Label normal_sequence;
5441 if (mode == DONT_OVERRIDE) { 5441 if (mode == DONT_OVERRIDE) {
5442 ASSERT(FAST_SMI_ELEMENTS == 0); 5442 ASSERT(FAST_SMI_ELEMENTS == 0);
5443 ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); 5443 ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
5444 ASSERT(FAST_ELEMENTS == 2); 5444 ASSERT(FAST_ELEMENTS == 2);
(...skipping 20 matching lines...) Expand all
5465 __ TailCallStub(&stub_holey); 5465 __ TailCallStub(&stub_holey);
5466 5466
5467 __ bind(&normal_sequence); 5467 __ bind(&normal_sequence);
5468 ArraySingleArgumentConstructorStub stub(initial, 5468 ArraySingleArgumentConstructorStub stub(initial,
5469 DISABLE_ALLOCATION_SITES); 5469 DISABLE_ALLOCATION_SITES);
5470 __ TailCallStub(&stub); 5470 __ TailCallStub(&stub);
5471 } else if (mode == DONT_OVERRIDE) { 5471 } else if (mode == DONT_OVERRIDE) {
5472 // We are going to create a holey array, but our kind is non-holey. 5472 // We are going to create a holey array, but our kind is non-holey.
5473 // Fix kind and retry. 5473 // Fix kind and retry.
5474 __ inc(edx); 5474 __ inc(edx);
5475 __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset)); 5475
5476 if (FLAG_debug_code) { 5476 if (FLAG_debug_code) {
5477 Handle<Map> allocation_site_map = 5477 Handle<Map> allocation_site_map =
5478 masm->isolate()->factory()->allocation_site_map(); 5478 masm->isolate()->factory()->allocation_site_map();
5479 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); 5479 __ cmp(FieldOperand(ebx, 0), Immediate(allocation_site_map));
5480 __ Assert(equal, kExpectedAllocationSiteInCell); 5480 __ Assert(equal, kExpectedAllocationSite);
5481 } 5481 }
5482 5482
5483 // Save the resulting elements kind in type info. We can't just store r3 5483 // Save the resulting elements kind in type info. We can't just store r3
5484 // in the AllocationSite::transition_info field because elements kind is 5484 // in the AllocationSite::transition_info field because elements kind is
5485 // restricted to a portion of the field...upper bits need to be left alone. 5485 // restricted to a portion of the field...upper bits need to be left alone.
5486 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 5486 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
5487 __ add(FieldOperand(ecx, AllocationSite::kTransitionInfoOffset), 5487 __ add(FieldOperand(ebx, AllocationSite::kTransitionInfoOffset),
5488 Immediate(Smi::FromInt(kFastElementsKindPackedToHoley))); 5488 Immediate(Smi::FromInt(kFastElementsKindPackedToHoley)));
5489 5489
5490 __ bind(&normal_sequence); 5490 __ bind(&normal_sequence);
5491 int last_index = GetSequenceIndexFromFastElementsKind( 5491 int last_index = GetSequenceIndexFromFastElementsKind(
5492 TERMINAL_FAST_ELEMENTS_KIND); 5492 TERMINAL_FAST_ELEMENTS_KIND);
5493 for (int i = 0; i <= last_index; ++i) { 5493 for (int i = 0; i <= last_index; ++i) {
5494 Label next; 5494 Label next;
5495 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5495 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5496 __ cmp(edx, kind); 5496 __ cmp(edx, kind);
5497 __ j(not_equal, &next); 5497 __ j(not_equal, &next);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
5609 __ cmp(FieldOperand(ebx, 0), Immediate(cell_map)); 5609 __ cmp(FieldOperand(ebx, 0), Immediate(cell_map));
5610 __ Assert(equal, kExpectedPropertyCellInRegisterEbx); 5610 __ Assert(equal, kExpectedPropertyCellInRegisterEbx);
5611 __ bind(&okay_here); 5611 __ bind(&okay_here);
5612 } 5612 }
5613 5613
5614 Label no_info; 5614 Label no_info;
5615 // If the type cell is undefined, or contains anything other than an 5615 // If the type cell is undefined, or contains anything other than an
5616 // AllocationSite, call an array constructor that doesn't use AllocationSites. 5616 // AllocationSite, call an array constructor that doesn't use AllocationSites.
5617 __ cmp(ebx, Immediate(undefined_sentinel)); 5617 __ cmp(ebx, Immediate(undefined_sentinel));
5618 __ j(equal, &no_info); 5618 __ j(equal, &no_info);
5619 __ mov(edx, FieldOperand(ebx, Cell::kValueOffset)); 5619 __ mov(ebx, FieldOperand(ebx, Cell::kValueOffset));
5620 __ cmp(FieldOperand(edx, 0), Immediate( 5620 __ cmp(FieldOperand(ebx, 0), Immediate(
5621 masm->isolate()->factory()->allocation_site_map())); 5621 masm->isolate()->factory()->allocation_site_map()));
5622 __ j(not_equal, &no_info); 5622 __ j(not_equal, &no_info);
5623 5623
5624 // Only look at the lower 16 bits of the transition info. 5624 // Only look at the lower 16 bits of the transition info.
5625 __ mov(edx, FieldOperand(edx, AllocationSite::kTransitionInfoOffset)); 5625 __ mov(edx, FieldOperand(ebx, AllocationSite::kTransitionInfoOffset));
5626 __ SmiUntag(edx); 5626 __ SmiUntag(edx);
5627 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 5627 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
5628 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); 5628 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask));
5629 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 5629 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
5630 5630
5631 __ bind(&no_info); 5631 __ bind(&no_info);
5632 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 5632 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
5633 } 5633 }
5634 5634
5635 5635
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
5719 __ bind(&fast_elements_case); 5719 __ bind(&fast_elements_case);
5720 GenerateCase(masm, FAST_ELEMENTS); 5720 GenerateCase(masm, FAST_ELEMENTS);
5721 } 5721 }
5722 5722
5723 5723
5724 #undef __ 5724 #undef __
5725 5725
5726 } } // namespace v8::internal 5726 } } // namespace v8::internal
5727 5727
5728 #endif // V8_TARGET_ARCH_IA32 5728 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698