OLD | NEW |
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 3303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3314 i::Zone zone(CcTest::i_isolate()->allocator()); | 3314 i::Zone zone(CcTest::i_isolate()->allocator()); |
3315 v8::Local<v8::Value> v = CompileRun(src); | 3315 v8::Local<v8::Value> v = CompileRun(src); |
3316 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); | 3316 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); |
3317 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); | 3317 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); |
3318 i::Context* context = f->context(); | 3318 i::Context* context = f->context(); |
3319 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); | 3319 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); |
3320 avf.Internalize(isolate); | 3320 avf.Internalize(isolate); |
3321 const i::AstRawString* name = avf.GetOneByteString("result"); | 3321 const i::AstRawString* name = avf.GetOneByteString("result"); |
3322 i::Handle<i::String> str = name->string(); | 3322 i::Handle<i::String> str = name->string(); |
3323 CHECK(str->IsInternalizedString()); | 3323 CHECK(str->IsInternalizedString()); |
3324 i::DeclarationScope* script_scope = new (&zone) i::DeclarationScope(&zone); | 3324 i::DeclarationScope* script_scope = |
| 3325 new (&zone) i::DeclarationScope(&zone, &avf); |
3325 i::Scope* s = i::Scope::DeserializeScopeChain( | 3326 i::Scope* s = i::Scope::DeserializeScopeChain( |
3326 isolate, &zone, context, script_scope, &avf, | 3327 isolate, &zone, context, script_scope, &avf, |
3327 i::Scope::DeserializationMode::kKeepScopeInfo); | 3328 i::Scope::DeserializationMode::kKeepScopeInfo); |
3328 CHECK(s != script_scope); | 3329 CHECK(s != script_scope); |
3329 CHECK(name != NULL); | 3330 CHECK(name != NULL); |
3330 | 3331 |
3331 // Get result from h's function context (that is f's context) | 3332 // Get result from h's function context (that is f's context) |
3332 i::Variable* var = s->Lookup(name); | 3333 i::Variable* var = s->Lookup(name); |
3333 | 3334 |
3334 CHECK(var != NULL); | 3335 CHECK(var != NULL); |
(...skipping 26 matching lines...) Expand all Loading... |
3361 source->PrintOn(stdout); | 3362 source->PrintOn(stdout); |
3362 printf("\n"); | 3363 printf("\n"); |
3363 i::Zone zone(CcTest::i_isolate()->allocator()); | 3364 i::Zone zone(CcTest::i_isolate()->allocator()); |
3364 v8::Local<v8::Value> v = CompileRun(src); | 3365 v8::Local<v8::Value> v = CompileRun(src); |
3365 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); | 3366 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); |
3366 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); | 3367 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); |
3367 i::Context* context = f->context(); | 3368 i::Context* context = f->context(); |
3368 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); | 3369 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); |
3369 avf.Internalize(isolate); | 3370 avf.Internalize(isolate); |
3370 | 3371 |
3371 i::DeclarationScope* script_scope = new (&zone) i::DeclarationScope(&zone); | 3372 i::DeclarationScope* script_scope = |
| 3373 new (&zone) i::DeclarationScope(&zone, &avf); |
3372 i::Scope* s = i::Scope::DeserializeScopeChain( | 3374 i::Scope* s = i::Scope::DeserializeScopeChain( |
3373 isolate, &zone, context, script_scope, &avf, | 3375 isolate, &zone, context, script_scope, &avf, |
3374 i::Scope::DeserializationMode::kKeepScopeInfo); | 3376 i::Scope::DeserializationMode::kKeepScopeInfo); |
3375 CHECK(s != script_scope); | 3377 CHECK(s != script_scope); |
3376 const i::AstRawString* name_x = avf.GetOneByteString("x"); | 3378 const i::AstRawString* name_x = avf.GetOneByteString("x"); |
3377 | 3379 |
3378 // Get result from f's function context (that is g's outer context) | 3380 // Get result from f's function context (that is g's outer context) |
3379 i::Variable* var_x = s->Lookup(name_x); | 3381 i::Variable* var_x = s->Lookup(name_x); |
3380 CHECK(var_x != NULL); | 3382 CHECK(var_x != NULL); |
3381 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned); | 3383 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned); |
(...skipping 4797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8179 "(a,);", | 8181 "(a,);", |
8180 "(a,b,c,);", | 8182 "(a,b,c,);", |
8181 NULL | 8183 NULL |
8182 }; | 8184 }; |
8183 // clang-format on | 8185 // clang-format on |
8184 | 8186 |
8185 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; | 8187 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; |
8186 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 8188 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
8187 arraysize(always_flags)); | 8189 arraysize(always_flags)); |
8188 } | 8190 } |
OLD | NEW |