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

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 7792098: Avoid dynamic lookup when initializing let declared variables. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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/parser.cc ('k') | test/mjsunit/harmony/debug-blockscopes.js » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 __ CallRuntime(Runtime::kStoreContextSlot, 4); 1841 __ CallRuntime(Runtime::kStoreContextSlot, 4);
1842 break; 1842 break;
1843 } 1843 }
1844 } else if (var->mode() != Variable::CONST) { 1844 } else if (var->mode() != Variable::CONST) {
1845 // Perform the assignment for non-const variables. Const assignments 1845 // Perform the assignment for non-const variables. Const assignments
1846 // are simply skipped. 1846 // are simply skipped.
1847 Slot* slot = var->AsSlot(); 1847 Slot* slot = var->AsSlot();
1848 switch (slot->type()) { 1848 switch (slot->type()) {
1849 case Slot::PARAMETER: 1849 case Slot::PARAMETER:
1850 case Slot::LOCAL: 1850 case Slot::LOCAL:
1851 if (FLAG_debug_code && op == Token::INIT_LET) {
1852 // Check for an uninitialized let binding.
1853 __ movq(rdx, Operand(rbp, SlotOffset(slot)));
1854 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex);
1855 __ Check(equal, "Let binding re-initialization.");
1856 }
1851 // Perform the assignment. 1857 // Perform the assignment.
1852 __ movq(Operand(rbp, SlotOffset(slot)), rax); 1858 __ movq(Operand(rbp, SlotOffset(slot)), rax);
1853 break; 1859 break;
1854 1860
1855 case Slot::CONTEXT: { 1861 case Slot::CONTEXT: {
1856 MemOperand target = EmitSlotSearch(slot, rcx); 1862 MemOperand target = EmitSlotSearch(slot, rcx);
1863 if (FLAG_debug_code && op == Token::INIT_LET) {
1864 // Check for an uninitialized let binding.
1865 __ movq(rdx, target);
1866 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex);
1867 __ Check(equal, "Let binding re-initialization.");
1868 }
1857 // Perform the assignment and issue the write barrier. 1869 // Perform the assignment and issue the write barrier.
1858 __ movq(target, rax); 1870 __ movq(target, rax);
1859 // The value of the assignment is in rax. RecordWrite clobbers its 1871 // The value of the assignment is in rax. RecordWrite clobbers its
1860 // register arguments. 1872 // register arguments.
1861 __ movq(rdx, rax); 1873 __ movq(rdx, rax);
1862 int offset = Context::SlotOffset(slot->index()); 1874 int offset = Context::SlotOffset(slot->index());
1863 __ RecordWrite(rcx, offset, rdx, rbx); 1875 __ RecordWrite(rcx, offset, rdx, rbx);
1864 break; 1876 break;
1865 } 1877 }
1866 1878
1867 case Slot::LOOKUP: 1879 case Slot::LOOKUP:
1880 ASSERT(op != Token::INIT_LET);
1868 // Call the runtime for the assignment. 1881 // Call the runtime for the assignment.
1869 __ push(rax); // Value. 1882 __ push(rax); // Value.
1870 __ push(rsi); // Context. 1883 __ push(rsi); // Context.
1871 __ Push(var->name()); 1884 __ Push(var->name());
1872 __ Push(Smi::FromInt(strict_mode_flag())); 1885 __ Push(Smi::FromInt(strict_mode_flag()));
1873 __ CallRuntime(Runtime::kStoreContextSlot, 4); 1886 __ CallRuntime(Runtime::kStoreContextSlot, 4);
1874 break; 1887 break;
1875 } 1888 }
1876 } 1889 }
1877 } 1890 }
(...skipping 2334 matching lines...) Expand 10 before | Expand all | Expand 10 after
4212 __ jmp(rdx); 4225 __ jmp(rdx);
4213 } 4226 }
4214 4227
4215 4228
4216 #undef __ 4229 #undef __
4217 4230
4218 4231
4219 } } // namespace v8::internal 4232 } } // namespace v8::internal
4220 4233
4221 #endif // V8_TARGET_ARCH_X64 4234 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | test/mjsunit/harmony/debug-blockscopes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698