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

Side by Side Diff: src/scopes.cc

Issue 10121007: Allow more functions to be lazy compiled. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 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/scopes.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 if (!ResolveVariablesRecursively(info, factory)) return false; 623 if (!ResolveVariablesRecursively(info, factory)) return false;
624 624
625 // 3) Allocate variables. 625 // 3) Allocate variables.
626 AllocateVariablesRecursively(); 626 AllocateVariablesRecursively();
627 627
628 return true; 628 return true;
629 } 629 }
630 630
631 631
632 bool Scope::AllowsLazyCompilation() const { 632 bool Scope::AllowsLazyCompilation() const {
633 return !force_eager_compilation_;
634 }
635
636
637 bool Scope::AllowsLazyCompilationForNative() const {
633 return !force_eager_compilation_ && HasTrivialOuterContext(); 638 return !force_eager_compilation_ && HasTrivialOuterContext();
634 } 639 }
635 640
636 641
637 bool Scope::HasTrivialContext() const { 642 bool Scope::HasTrivialContext() const {
638 // A function scope has a trivial context if it always is the global 643 // A function scope has a trivial context if it always is the global
639 // context. We iteratively scan out the context chain to see if 644 // context. We iteratively scan out the context chain to see if
640 // there is anything that makes this scope non-trivial; otherwise we 645 // there is anything that makes this scope non-trivial; otherwise we
641 // return true. 646 // return true.
642 for (const Scope* scope = this; scope != NULL; scope = scope->outer_scope_) { 647 for (const Scope* scope = this; scope != NULL; scope = scope->outer_scope_) {
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 } 1269 }
1265 1270
1266 1271
1267 int Scope::ContextLocalCount() const { 1272 int Scope::ContextLocalCount() const {
1268 if (num_heap_slots() == 0) return 0; 1273 if (num_heap_slots() == 0) return 0;
1269 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1274 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1270 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); 1275 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0);
1271 } 1276 }
1272 1277
1273 } } // namespace v8::internal 1278 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/scopes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698