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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2561103004: [parser] Ensure asm.js modules always allocate context. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « src/ast/scopes.cc ('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 3428 matching lines...) Expand 10 before | Expand all | Expand 10 after
3439 new (zone) i::DeclarationScope(zone, &avf); 3439 new (zone) i::DeclarationScope(zone, &avf);
3440 i::Scope* s = i::Scope::DeserializeScopeChain( 3440 i::Scope* s = i::Scope::DeserializeScopeChain(
3441 isolate, zone, f->context()->scope_info(), script_scope, &avf, 3441 isolate, zone, f->context()->scope_info(), script_scope, &avf,
3442 i::Scope::DeserializationMode::kIncludingVariables); 3442 i::Scope::DeserializationMode::kIncludingVariables);
3443 return s; 3443 return s;
3444 } 3444 }
3445 3445
3446 } // namespace 3446 } // namespace
3447 3447
3448 TEST(AsmModuleFlag) { 3448 TEST(AsmModuleFlag) {
3449 i::FLAG_validate_asm = false;
3449 i::Isolate* isolate = CcTest::i_isolate(); 3450 i::Isolate* isolate = CcTest::i_isolate();
3450 i::HandleScope scope(isolate); 3451 i::HandleScope scope(isolate);
3451 LocalContext env; 3452 LocalContext env;
3452 3453
3453 const char* src = 3454 const char* src =
3454 "function m() {" 3455 "function m() {"
3455 " 'use asm';" 3456 " 'use asm';"
3456 " var x = 0;" 3457 " function f() { return 0 };"
3457 " function f() { return x };"
3458 " return { f:f };" 3458 " return { f:f };"
3459 "}" 3459 "}"
3460 "m();"; 3460 "m();";
3461 3461
3462 i::Zone zone(isolate->allocator(), ZONE_NAME); 3462 i::Zone zone(isolate->allocator(), ZONE_NAME);
3463 v8::Local<v8::Value> v = CompileRun(src); 3463 v8::Local<v8::Value> v = CompileRun(src);
3464 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); 3464 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
3465 i::Handle<i::JSObject> m = i::Handle<i::JSObject>::cast(o); 3465 i::Handle<i::JSObject> m = i::Handle<i::JSObject>::cast(o);
3466 3466
3467 // The asm.js module should be marked as such. 3467 // The asm.js module should be marked as such.
(...skipping 5089 matching lines...) Expand 10 before | Expand all | Expand 10 after
8557 DCHECK_NOT_NULL(scope); 8557 DCHECK_NOT_NULL(scope);
8558 DCHECK_NULL(scope->sibling()); 8558 DCHECK_NULL(scope->sibling());
8559 DCHECK(scope->is_function_scope()); 8559 DCHECK(scope->is_function_scope());
8560 const i::AstRawString* var_name = 8560 const i::AstRawString* var_name =
8561 info.ast_value_factory()->GetOneByteString("my_var"); 8561 info.ast_value_factory()->GetOneByteString("my_var");
8562 i::Variable* var = scope->Lookup(var_name); 8562 i::Variable* var = scope->Lookup(var_name);
8563 CHECK_EQ(inners[i].ctxt_allocate, 8563 CHECK_EQ(inners[i].ctxt_allocate,
8564 i::ScopeTestHelper::MustAllocateInContext(var)); 8564 i::ScopeTestHelper::MustAllocateInContext(var));
8565 } 8565 }
8566 } 8566 }
OLDNEW
« no previous file with comments | « src/ast/scopes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698