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

Unified Diff: src/factory.cc

Issue 2263523002: Add some scope-related DCHECKs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable test262 module tests. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/variables.h ('k') | test/test262/test262.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 1124e63da9202e2c1695f4bbf9e48b5a18f7ae5f..84200cad1ac869fb4612b26ff44f7c7720338401 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -760,6 +760,7 @@ Handle<Context> Factory::NewNativeContext() {
Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function,
Handle<ScopeInfo> scope_info) {
+ DCHECK_EQ(scope_info->scope_type(), SCRIPT_SCOPE);
Handle<FixedArray> array =
NewFixedArray(scope_info->ContextLength(), TENURED);
array->set_map_no_write_barrier(*script_context_map());
@@ -784,6 +785,7 @@ Handle<ScriptContextTable> Factory::NewScriptContextTable() {
Handle<Context> Factory::NewModuleContext(Handle<ScopeInfo> scope_info) {
+ DCHECK_EQ(scope_info->scope_type(), MODULE_SCOPE);
Handle<FixedArray> array =
NewFixedArray(scope_info->ContextLength(), TENURED);
array->set_map_no_write_barrier(*module_context_map());
@@ -796,6 +798,7 @@ Handle<Context> Factory::NewModuleContext(Handle<ScopeInfo> scope_info) {
Handle<Context> Factory::NewFunctionContext(int length,
Handle<JSFunction> function) {
+ DCHECK(function->shared()->scope_info()->scope_type() == FUNCTION_SCOPE);
DCHECK(length >= Context::MIN_CONTEXT_SLOTS);
Handle<FixedArray> array = NewFixedArray(length);
array->set_map_no_write_barrier(*function_context_map());
@@ -858,6 +861,7 @@ Handle<Context> Factory::NewWithContext(Handle<JSFunction> function,
Handle<Context> Factory::NewBlockContext(Handle<JSFunction> function,
Handle<Context> previous,
Handle<ScopeInfo> scope_info) {
+ DCHECK_EQ(scope_info->scope_type(), BLOCK_SCOPE);
Handle<FixedArray> array = NewFixedArray(scope_info->ContextLength());
array->set_map_no_write_barrier(*block_context_map());
Handle<Context> context = Handle<Context>::cast(array);
« no previous file with comments | « src/ast/variables.h ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698