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

Side by Side Diff: src/arm/full-codegen-arm.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 | « no previous file | src/ia32/full-codegen-ia32.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 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 break; 1929 break;
1930 } 1930 }
1931 1931
1932 } else if (var->mode() != Variable::CONST) { 1932 } else if (var->mode() != Variable::CONST) {
1933 // Perform the assignment for non-const variables. Const assignments 1933 // Perform the assignment for non-const variables. Const assignments
1934 // are simply skipped. 1934 // are simply skipped.
1935 Slot* slot = var->AsSlot(); 1935 Slot* slot = var->AsSlot();
1936 switch (slot->type()) { 1936 switch (slot->type()) {
1937 case Slot::PARAMETER: 1937 case Slot::PARAMETER:
1938 case Slot::LOCAL: 1938 case Slot::LOCAL:
1939 if (FLAG_debug_code && op == Token::INIT_LET) {
1940 // Check for an uninitialized let binding.
1941 __ ldr(r1, MemOperand(fp, SlotOffset(slot)));
1942 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
1943 __ cmp(r1, ip);
1944 __ Check(eq, "Let binding re-initialization.");
1945 }
1939 // Perform the assignment. 1946 // Perform the assignment.
1940 __ str(result_register(), MemOperand(fp, SlotOffset(slot))); 1947 __ str(result_register(), MemOperand(fp, SlotOffset(slot)));
1941 break; 1948 break;
1942 1949
1943 case Slot::CONTEXT: { 1950 case Slot::CONTEXT: {
1944 MemOperand target = EmitSlotSearch(slot, r1); 1951 MemOperand target = EmitSlotSearch(slot, r1);
1952 if (FLAG_debug_code && op == Token::INIT_LET) {
1953 // Check for an uninitialized let binding.
1954 __ ldr(r3, target);
1955 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
1956 __ cmp(r3, ip);
1957 __ Check(eq, "Let binding re-initialization.");
1958 }
1945 // Perform the assignment and issue the write barrier. 1959 // Perform the assignment and issue the write barrier.
1946 __ str(result_register(), target); 1960 __ str(result_register(), target);
1947 // RecordWrite may destroy all its register arguments. 1961 // RecordWrite may destroy all its register arguments.
1948 __ mov(r3, result_register()); 1962 __ mov(r3, result_register());
1949 int offset = FixedArray::kHeaderSize + slot->index() * kPointerSize; 1963 int offset = FixedArray::kHeaderSize + slot->index() * kPointerSize;
1950 __ RecordWrite(r1, Operand(offset), r2, r3); 1964 __ RecordWrite(r1, Operand(offset), r2, r3);
1951 break; 1965 break;
1952 } 1966 }
1953 1967
1954 case Slot::LOOKUP: 1968 case Slot::LOOKUP:
1969 ASSERT(op != Token::INIT_LET);
1955 // Call the runtime for the assignment. 1970 // Call the runtime for the assignment.
1956 __ push(r0); // Value. 1971 __ push(r0); // Value.
1957 __ mov(r1, Operand(slot->var()->name())); 1972 __ mov(r1, Operand(slot->var()->name()));
1958 __ mov(r0, Operand(Smi::FromInt(strict_mode_flag()))); 1973 __ mov(r0, Operand(Smi::FromInt(strict_mode_flag())));
1959 __ Push(cp, r1, r0); // Context, name, strict mode. 1974 __ Push(cp, r1, r0); // Context, name, strict mode.
1960 __ CallRuntime(Runtime::kStoreContextSlot, 4); 1975 __ CallRuntime(Runtime::kStoreContextSlot, 4);
1961 break; 1976 break;
1962 } 1977 }
1963 } 1978 }
1964 } 1979 }
(...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after
4273 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 4288 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
4274 __ add(pc, r1, Operand(masm_->CodeObject())); 4289 __ add(pc, r1, Operand(masm_->CodeObject()));
4275 } 4290 }
4276 4291
4277 4292
4278 #undef __ 4293 #undef __
4279 4294
4280 } } // namespace v8::internal 4295 } } // namespace v8::internal
4281 4296
4282 #endif // V8_TARGET_ARCH_ARM 4297 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698