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

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

Issue 969943003: X87: Implement subclassing Arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 4270 matching lines...) Expand 10 before | Expand all | Expand 10 after
4281 } else if (argument_count() == MORE_THAN_ONE) { 4281 } else if (argument_count() == MORE_THAN_ONE) {
4282 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); 4282 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode);
4283 } else { 4283 } else {
4284 UNREACHABLE(); 4284 UNREACHABLE();
4285 } 4285 }
4286 } 4286 }
4287 4287
4288 4288
4289 void ArrayConstructorStub::Generate(MacroAssembler* masm) { 4289 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
4290 // ----------- S t a t e ------------- 4290 // ----------- S t a t e -------------
4291 // -- eax : argc (only if argument_count() == ANY) 4291 // -- eax : argc (only if argument_count() is ANY or MORE_THAN_ONE)
4292 // -- ebx : AllocationSite or undefined 4292 // -- ebx : AllocationSite or undefined
4293 // -- edi : constructor 4293 // -- edi : constructor
4294 // -- edx : Original constructor 4294 // -- edx : Original constructor
4295 // -- esp[0] : return address 4295 // -- esp[0] : return address
4296 // -- esp[4] : last argument 4296 // -- esp[4] : last argument
4297 // ----------------------------------- 4297 // -----------------------------------
4298 if (FLAG_debug_code) { 4298 if (FLAG_debug_code) {
4299 // The array construct code is only set for the global and natives 4299 // The array construct code is only set for the global and natives
4300 // builtin Array functions which always have maps. 4300 // builtin Array functions which always have maps.
4301 4301
(...skipping 13 matching lines...) Expand all
4315 4315
4316 __ cmp(edx, edi); 4316 __ cmp(edx, edi);
4317 __ j(not_equal, &subclassing); 4317 __ j(not_equal, &subclassing);
4318 4318
4319 Label no_info; 4319 Label no_info;
4320 // If the feedback vector is the undefined value call an array constructor 4320 // If the feedback vector is the undefined value call an array constructor
4321 // that doesn't use AllocationSites. 4321 // that doesn't use AllocationSites.
4322 __ cmp(ebx, isolate()->factory()->undefined_value()); 4322 __ cmp(ebx, isolate()->factory()->undefined_value());
4323 __ j(equal, &no_info); 4323 __ j(equal, &no_info);
4324 4324
4325 __ cmp(edx, edi);
4326 __ j(not_equal, &subclassing);
4327
4328 // Only look at the lower 16 bits of the transition info. 4325 // Only look at the lower 16 bits of the transition info.
4329 __ mov(edx, FieldOperand(ebx, AllocationSite::kTransitionInfoOffset)); 4326 __ mov(edx, FieldOperand(ebx, AllocationSite::kTransitionInfoOffset));
4330 __ SmiUntag(edx); 4327 __ SmiUntag(edx);
4331 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 4328 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
4332 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); 4329 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask));
4333 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 4330 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
4334 4331
4335 __ bind(&no_info); 4332 __ bind(&no_info);
4336 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 4333 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
4337 4334
4335 // Subclassing.
4338 __ bind(&subclassing); 4336 __ bind(&subclassing);
4339 __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1); 4337 __ pop(ecx); // return address.
4338 __ push(edi);
4339 __ push(edx);
4340
4341 // Adjust argc.
4342 switch (argument_count()) {
4343 case ANY:
4344 case MORE_THAN_ONE:
4345 __ add(eax, Immediate(2));
4346 break;
4347 case NONE:
4348 __ mov(eax, Immediate(2));
4349 break;
4350 case ONE:
4351 __ mov(eax, Immediate(3));
4352 break;
4353 }
4354
4355 __ push(ecx);
4356 __ JumpToExternalReference(
4357 ExternalReference(Runtime::kArrayConstructorWithSubclassing, isolate()));
4340 } 4358 }
4341 4359
4342 4360
4343 void InternalArrayConstructorStub::GenerateCase( 4361 void InternalArrayConstructorStub::GenerateCase(
4344 MacroAssembler* masm, ElementsKind kind) { 4362 MacroAssembler* masm, ElementsKind kind) {
4345 Label not_zero_case, not_one_case; 4363 Label not_zero_case, not_one_case;
4346 Label normal_sequence; 4364 Label normal_sequence;
4347 4365
4348 __ test(eax, eax); 4366 __ test(eax, eax);
4349 __ j(not_zero, &not_zero_case); 4367 __ j(not_zero, &not_zero_case);
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
4811 ApiParameterOperand(2), kStackSpace, nullptr, 4829 ApiParameterOperand(2), kStackSpace, nullptr,
4812 Operand(ebp, 7 * kPointerSize), NULL); 4830 Operand(ebp, 7 * kPointerSize), NULL);
4813 } 4831 }
4814 4832
4815 4833
4816 #undef __ 4834 #undef __
4817 4835
4818 } } // namespace v8::internal 4836 } } // namespace v8::internal
4819 4837
4820 #endif // V8_TARGET_ARCH_X87 4838 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698