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

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

Issue 8479034: Reapply r9870 "Remove some initialization checks based on source positions.". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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
« no previous file with comments | « src/ia32/full-codegen-ia32.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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 // 1306 //
1307 // We cannot skip any initialization checks for CONST in non-harmony 1307 // We cannot skip any initialization checks for CONST in non-harmony
1308 // mode because const variables may be declared but never initialized: 1308 // mode because const variables may be declared but never initialized:
1309 // if (false) { const x; }; var y = x; 1309 // if (false) { const x; }; var y = x;
1310 // 1310 //
1311 // The condition on the declaration scopes is a conservative check for 1311 // The condition on the declaration scopes is a conservative check for
1312 // nested functions that access a binding and are called before the 1312 // nested functions that access a binding and are called before the
1313 // binding is initialized: 1313 // binding is initialized:
1314 // function() { f(); let x = 1; function f() { x = 2; } } 1314 // function() { f(); let x = 1; function f() { x = 2; } }
1315 // 1315 //
1316 // Check that we always have valid source position. 1316 bool skip_init_check;
1317 ASSERT(var->initializer_position() != RelocInfo::kNoPosition); 1317 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
1318 ASSERT(proxy->position() != RelocInfo::kNoPosition); 1318 skip_init_check = false;
1319 bool skip_init_check = 1319 } else {
1320 var->mode() != CONST && 1320 // Check that we always have valid source position.
1321 var->scope()->DeclarationScope() == scope()->DeclarationScope() && 1321 ASSERT(var->initializer_position() != RelocInfo::kNoPosition);
1322 var->initializer_position() < proxy->position(); 1322 ASSERT(proxy->position() != RelocInfo::kNoPosition);
1323 skip_init_check = var->mode() != CONST &&
1324 var->initializer_position() < proxy->position();
1325 }
1326
1323 if (!skip_init_check) { 1327 if (!skip_init_check) {
1324 // Let and const need a read barrier. 1328 // Let and const need a read barrier.
1325 GetVar(v0, var); 1329 GetVar(v0, var);
1326 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 1330 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
1327 __ subu(at, v0, at); // Sub as compare: at == 0 on eq. 1331 __ subu(at, v0, at); // Sub as compare: at == 0 on eq.
1328 if (var->mode() == LET || var->mode() == CONST_HARMONY) { 1332 if (var->mode() == LET || var->mode() == CONST_HARMONY) {
1329 // Throw a reference error when using an uninitialized let/const 1333 // Throw a reference error when using an uninitialized let/const
1330 // binding in harmony mode. 1334 // binding in harmony mode.
1331 Label done; 1335 Label done;
1332 __ Branch(&done, ne, at, Operand(zero_reg)); 1336 __ Branch(&done, ne, at, Operand(zero_reg));
(...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after
4416 *context_length = 0; 4420 *context_length = 0;
4417 return previous_; 4421 return previous_;
4418 } 4422 }
4419 4423
4420 4424
4421 #undef __ 4425 #undef __
4422 4426
4423 } } // namespace v8::internal 4427 } } // namespace v8::internal
4424 4428
4425 #endif // V8_TARGET_ARCH_MIPS 4429 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698