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

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

Issue 128683002: Array constructor can be simplified by loading context from JSFunction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Simple ports. 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/mips/lithium-codegen-mips.cc ('k') | src/x64/lithium-codegen-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 5190 matching lines...) Expand 10 before | Expand all | Expand 10 after
5201 __ pop(arg_reg_1); 5201 __ pop(arg_reg_1);
5202 5202
5203 __ Ret(); 5203 __ Ret();
5204 } 5204 }
5205 5205
5206 5206
5207 template<class T> 5207 template<class T>
5208 static void CreateArrayDispatch(MacroAssembler* masm, 5208 static void CreateArrayDispatch(MacroAssembler* masm,
5209 AllocationSiteOverrideMode mode) { 5209 AllocationSiteOverrideMode mode) {
5210 if (mode == DISABLE_ALLOCATION_SITES) { 5210 if (mode == DISABLE_ALLOCATION_SITES) {
5211 T stub(GetInitialFastElementsKind(), 5211 T stub(GetInitialFastElementsKind(), mode);
5212 CONTEXT_CHECK_REQUIRED,
5213 mode);
5214 __ TailCallStub(&stub); 5212 __ TailCallStub(&stub);
5215 } else if (mode == DONT_OVERRIDE) { 5213 } else if (mode == DONT_OVERRIDE) {
5216 int last_index = GetSequenceIndexFromFastElementsKind( 5214 int last_index = GetSequenceIndexFromFastElementsKind(
5217 TERMINAL_FAST_ELEMENTS_KIND); 5215 TERMINAL_FAST_ELEMENTS_KIND);
5218 for (int i = 0; i <= last_index; ++i) { 5216 for (int i = 0; i <= last_index; ++i) {
5219 Label next; 5217 Label next;
5220 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5218 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5221 __ cmpl(rdx, Immediate(kind)); 5219 __ cmpl(rdx, Immediate(kind));
5222 __ j(not_equal, &next); 5220 __ j(not_equal, &next);
5223 T stub(kind); 5221 T stub(kind);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
5263 StackArgumentsAccessor args(rsp, 1, ARGUMENTS_DONT_CONTAIN_RECEIVER); 5261 StackArgumentsAccessor args(rsp, 1, ARGUMENTS_DONT_CONTAIN_RECEIVER);
5264 __ movq(rcx, args.GetArgumentOperand(0)); 5262 __ movq(rcx, args.GetArgumentOperand(0));
5265 __ testq(rcx, rcx); 5263 __ testq(rcx, rcx);
5266 __ j(zero, &normal_sequence); 5264 __ j(zero, &normal_sequence);
5267 5265
5268 if (mode == DISABLE_ALLOCATION_SITES) { 5266 if (mode == DISABLE_ALLOCATION_SITES) {
5269 ElementsKind initial = GetInitialFastElementsKind(); 5267 ElementsKind initial = GetInitialFastElementsKind();
5270 ElementsKind holey_initial = GetHoleyElementsKind(initial); 5268 ElementsKind holey_initial = GetHoleyElementsKind(initial);
5271 5269
5272 ArraySingleArgumentConstructorStub stub_holey(holey_initial, 5270 ArraySingleArgumentConstructorStub stub_holey(holey_initial,
5273 CONTEXT_CHECK_REQUIRED,
5274 DISABLE_ALLOCATION_SITES); 5271 DISABLE_ALLOCATION_SITES);
5275 __ TailCallStub(&stub_holey); 5272 __ TailCallStub(&stub_holey);
5276 5273
5277 __ bind(&normal_sequence); 5274 __ bind(&normal_sequence);
5278 ArraySingleArgumentConstructorStub stub(initial, 5275 ArraySingleArgumentConstructorStub stub(initial,
5279 CONTEXT_CHECK_REQUIRED,
5280 DISABLE_ALLOCATION_SITES); 5276 DISABLE_ALLOCATION_SITES);
5281 __ TailCallStub(&stub); 5277 __ TailCallStub(&stub);
5282 } else if (mode == DONT_OVERRIDE) { 5278 } else if (mode == DONT_OVERRIDE) {
5283 // We are going to create a holey array, but our kind is non-holey. 5279 // We are going to create a holey array, but our kind is non-holey.
5284 // Fix kind and retry (only if we have an allocation site in the cell). 5280 // Fix kind and retry (only if we have an allocation site in the cell).
5285 __ incl(rdx); 5281 __ incl(rdx);
5286 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset)); 5282 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset));
5287 if (FLAG_debug_code) { 5283 if (FLAG_debug_code) {
5288 Handle<Map> allocation_site_map = 5284 Handle<Map> allocation_site_map =
5289 masm->isolate()->factory()->allocation_site_map(); 5285 masm->isolate()->factory()->allocation_site_map();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5321 5317
5322 template<class T> 5318 template<class T>
5323 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { 5319 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
5324 int to_index = GetSequenceIndexFromFastElementsKind( 5320 int to_index = GetSequenceIndexFromFastElementsKind(
5325 TERMINAL_FAST_ELEMENTS_KIND); 5321 TERMINAL_FAST_ELEMENTS_KIND);
5326 for (int i = 0; i <= to_index; ++i) { 5322 for (int i = 0; i <= to_index; ++i) {
5327 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5323 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5328 T stub(kind); 5324 T stub(kind);
5329 stub.GetCode(isolate); 5325 stub.GetCode(isolate);
5330 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { 5326 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) {
5331 T stub1(kind, CONTEXT_CHECK_REQUIRED, DISABLE_ALLOCATION_SITES); 5327 T stub1(kind, DISABLE_ALLOCATION_SITES);
5332 stub1.GetCode(isolate); 5328 stub1.GetCode(isolate);
5333 } 5329 }
5334 } 5330 }
5335 } 5331 }
5336 5332
5337 5333
5338 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { 5334 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) {
5339 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( 5335 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
5340 isolate); 5336 isolate);
5341 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( 5337 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>(
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
5533 __ bind(&fast_elements_case); 5529 __ bind(&fast_elements_case);
5534 GenerateCase(masm, FAST_ELEMENTS); 5530 GenerateCase(masm, FAST_ELEMENTS);
5535 } 5531 }
5536 5532
5537 5533
5538 #undef __ 5534 #undef __
5539 5535
5540 } } // namespace v8::internal 5536 } } // namespace v8::internal
5541 5537
5542 #endif // V8_TARGET_ARCH_X64 5538 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698