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

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

Issue 55933002: Inline array constructor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Even better codegen for 1 arg case, and refactoring. Created 7 years, 1 month 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 5745 matching lines...) Expand 10 before | Expand all | Expand 10 after
5756 __ inc(edx); 5756 __ inc(edx);
5757 __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset)); 5757 __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset));
5758 if (FLAG_debug_code) { 5758 if (FLAG_debug_code) {
5759 Handle<Map> allocation_site_map = 5759 Handle<Map> allocation_site_map =
5760 masm->isolate()->factory()->allocation_site_map(); 5760 masm->isolate()->factory()->allocation_site_map();
5761 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); 5761 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map));
5762 __ Assert(equal, kExpectedAllocationSiteInCell); 5762 __ Assert(equal, kExpectedAllocationSiteInCell);
5763 } 5763 }
5764 5764
5765 // Save the resulting elements kind in type info 5765 // Save the resulting elements kind in type info
5766 __ SmiTag(edx); 5766 __ add(FieldOperand(ecx, AllocationSite::kTransitionInfoOffset),
5767 __ mov(FieldOperand(ecx, AllocationSite::kTransitionInfoOffset), edx); 5767 Immediate(2));
Toon Verwaest 2013/11/06 16:42:44 I don't know what the line above means.
mvstanton 2013/11/07 16:34:05 Trying to be clever adding 1 to a smi in memory. :
5768 __ SmiUntag(edx); 5768 /*
Toon Verwaest 2013/11/06 16:42:44 leftover comment?
mvstanton 2013/11/07 16:34:05 Done.
5769 __ inc(FieldOperand(ecx, AllocationSite::kTransitionInfoOffset));
5770 __ inc(FieldOperand(ecx, AllocationSite::kTransitionInfoOffset));
5771 */
5769 5772
5770 __ bind(&normal_sequence); 5773 __ bind(&normal_sequence);
5771 int last_index = GetSequenceIndexFromFastElementsKind( 5774 int last_index = GetSequenceIndexFromFastElementsKind(
5772 TERMINAL_FAST_ELEMENTS_KIND); 5775 TERMINAL_FAST_ELEMENTS_KIND);
5773 for (int i = 0; i <= last_index; ++i) { 5776 for (int i = 0; i <= last_index; ++i) {
5774 Label next; 5777 Label next;
5775 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5778 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5776 __ cmp(edx, kind); 5779 __ cmp(edx, kind);
5777 __ j(not_equal, &next); 5780 __ j(not_equal, &next);
5778 ArraySingleArgumentConstructorStub stub(kind); 5781 ArraySingleArgumentConstructorStub stub(kind);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
5899 Label no_info; 5902 Label no_info;
5900 // If the type cell is undefined, or contains anything other than an 5903 // If the type cell is undefined, or contains anything other than an
5901 // AllocationSite, call an array constructor that doesn't use AllocationSites. 5904 // AllocationSite, call an array constructor that doesn't use AllocationSites.
5902 __ cmp(ebx, Immediate(undefined_sentinel)); 5905 __ cmp(ebx, Immediate(undefined_sentinel));
5903 __ j(equal, &no_info); 5906 __ j(equal, &no_info);
5904 __ mov(edx, FieldOperand(ebx, Cell::kValueOffset)); 5907 __ mov(edx, FieldOperand(ebx, Cell::kValueOffset));
5905 __ cmp(FieldOperand(edx, 0), Immediate( 5908 __ cmp(FieldOperand(edx, 0), Immediate(
5906 masm->isolate()->factory()->allocation_site_map())); 5909 masm->isolate()->factory()->allocation_site_map()));
5907 __ j(not_equal, &no_info); 5910 __ j(not_equal, &no_info);
5908 5911
5912 // Only look at the lower 16 bits of the transition info.
5909 __ mov(edx, FieldOperand(edx, AllocationSite::kTransitionInfoOffset)); 5913 __ mov(edx, FieldOperand(edx, AllocationSite::kTransitionInfoOffset));
5910 __ SmiUntag(edx); 5914 __ SmiUntag(edx);
5915 __ and_(edx, Immediate(0xffff));
mvstanton 2013/11/07 16:34:05 Fixed this up too.
5911 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 5916 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
5912 5917
5913 __ bind(&no_info); 5918 __ bind(&no_info);
5914 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 5919 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
5915 } 5920 }
5916 5921
5917 5922
5918 void InternalArrayConstructorStub::GenerateCase( 5923 void InternalArrayConstructorStub::GenerateCase(
5919 MacroAssembler* masm, ElementsKind kind) { 5924 MacroAssembler* masm, ElementsKind kind) {
5920 Label not_zero_case, not_one_case; 5925 Label not_zero_case, not_one_case;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
6001 __ bind(&fast_elements_case); 6006 __ bind(&fast_elements_case);
6002 GenerateCase(masm, FAST_ELEMENTS); 6007 GenerateCase(masm, FAST_ELEMENTS);
6003 } 6008 }
6004 6009
6005 6010
6006 #undef __ 6011 #undef __
6007 6012
6008 } } // namespace v8::internal 6013 } } // namespace v8::internal
6009 6014
6010 #endif // V8_TARGET_ARCH_IA32 6015 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698