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

Side by Side Diff: src/ia32/full-codegen-ia32.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/arm/full-codegen-arm.cc ('k') | src/parser.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 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 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 __ CallRuntime(Runtime::kStoreContextSlot, 4); 1921 __ CallRuntime(Runtime::kStoreContextSlot, 4);
1922 break; 1922 break;
1923 } 1923 }
1924 } else if (var->mode() != Variable::CONST) { 1924 } else if (var->mode() != Variable::CONST) {
1925 // Perform the assignment for non-const variables. Const assignments 1925 // Perform the assignment for non-const variables. Const assignments
1926 // are simply skipped. 1926 // are simply skipped.
1927 Slot* slot = var->AsSlot(); 1927 Slot* slot = var->AsSlot();
1928 switch (slot->type()) { 1928 switch (slot->type()) {
1929 case Slot::PARAMETER: 1929 case Slot::PARAMETER:
1930 case Slot::LOCAL: 1930 case Slot::LOCAL:
1931 if (FLAG_debug_code && op == Token::INIT_LET) {
1932 // Check for an uninitialized let binding.
1933 __ mov(edx, Operand(ebp, SlotOffset(slot)));
1934 __ cmp(edx, isolate()->factory()->the_hole_value());
1935 __ Check(equal, "Let binding re-initialization.");
1936 }
1931 // Perform the assignment. 1937 // Perform the assignment.
1932 __ mov(Operand(ebp, SlotOffset(slot)), eax); 1938 __ mov(Operand(ebp, SlotOffset(slot)), eax);
1933 break; 1939 break;
1934 1940
1935 case Slot::CONTEXT: { 1941 case Slot::CONTEXT: {
1936 MemOperand target = EmitSlotSearch(slot, ecx); 1942 MemOperand target = EmitSlotSearch(slot, ecx);
1943 if (FLAG_debug_code && op == Token::INIT_LET) {
1944 // Check for an uninitialized let binding.
1945 __ mov(edx, target);
1946 __ cmp(edx, isolate()->factory()->the_hole_value());
1947 __ Check(equal, "Let binding re-initialization.");
1948 }
1937 // Perform the assignment and issue the write barrier. 1949 // Perform the assignment and issue the write barrier.
1938 __ mov(target, eax); 1950 __ mov(target, eax);
1939 // The value of the assignment is in eax. RecordWrite clobbers its 1951 // The value of the assignment is in eax. RecordWrite clobbers its
1940 // register arguments. 1952 // register arguments.
1941 __ mov(edx, eax); 1953 __ mov(edx, eax);
1942 int offset = Context::SlotOffset(slot->index()); 1954 int offset = Context::SlotOffset(slot->index());
1943 __ RecordWrite(ecx, offset, edx, ebx); 1955 __ RecordWrite(ecx, offset, edx, ebx);
1944 break; 1956 break;
1945 } 1957 }
1946 1958
1947 case Slot::LOOKUP: 1959 case Slot::LOOKUP:
1960 ASSERT(op != Token::INIT_LET);
1948 // Call the runtime for the assignment. 1961 // Call the runtime for the assignment.
1949 __ push(eax); // Value. 1962 __ push(eax); // Value.
1950 __ push(esi); // Context. 1963 __ push(esi); // Context.
1951 __ push(Immediate(var->name())); 1964 __ push(Immediate(var->name()));
1952 __ push(Immediate(Smi::FromInt(strict_mode_flag()))); 1965 __ push(Immediate(Smi::FromInt(strict_mode_flag())));
1953 __ CallRuntime(Runtime::kStoreContextSlot, 4); 1966 __ CallRuntime(Runtime::kStoreContextSlot, 4);
1954 break; 1967 break;
1955 } 1968 }
1956 } 1969 }
1957 } 1970 }
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after
4331 __ add(Operand(edx), Immediate(masm_->CodeObject())); 4344 __ add(Operand(edx), Immediate(masm_->CodeObject()));
4332 __ jmp(Operand(edx)); 4345 __ jmp(Operand(edx));
4333 } 4346 }
4334 4347
4335 4348
4336 #undef __ 4349 #undef __
4337 4350
4338 } } // namespace v8::internal 4351 } } // namespace v8::internal
4339 4352
4340 #endif // V8_TARGET_ARCH_IA32 4353 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698