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 3387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3398 i::Context* context = f->context(); | 3398 i::Context* context = f->context(); |
3399 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); | 3399 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); |
3400 avf.Internalize(isolate); | 3400 avf.Internalize(isolate); |
3401 const i::AstRawString* name = avf.GetOneByteString("result"); | 3401 const i::AstRawString* name = avf.GetOneByteString("result"); |
3402 i::Handle<i::String> str = name->string(); | 3402 i::Handle<i::String> str = name->string(); |
3403 CHECK(str->IsInternalizedString()); | 3403 CHECK(str->IsInternalizedString()); |
3404 i::DeclarationScope* script_scope = | 3404 i::DeclarationScope* script_scope = |
3405 new (&zone) i::DeclarationScope(&zone, &avf); | 3405 new (&zone) i::DeclarationScope(&zone, &avf); |
3406 i::Scope* s = i::Scope::DeserializeScopeChain( | 3406 i::Scope* s = i::Scope::DeserializeScopeChain( |
3407 isolate, &zone, context, script_scope, &avf, | 3407 isolate, &zone, context, script_scope, &avf, |
3408 i::Scope::DeserializationMode::kKeepScopeInfo); | 3408 i::Scope::DeserializationMode::kIncludingVariables); |
3409 CHECK(s != script_scope); | 3409 CHECK(s != script_scope); |
3410 CHECK(name != NULL); | 3410 CHECK(name != NULL); |
3411 | 3411 |
3412 // Get result from h's function context (that is f's context) | 3412 // Get result from h's function context (that is f's context) |
3413 i::Variable* var = s->Lookup(name); | 3413 i::Variable* var = s->Lookup(name); |
3414 | 3414 |
3415 CHECK(var != NULL); | 3415 CHECK(var != NULL); |
3416 // Maybe assigned should survive deserialization | 3416 // Maybe assigned should survive deserialization |
3417 CHECK(var->maybe_assigned() == i::kMaybeAssigned); | 3417 CHECK(var->maybe_assigned() == i::kMaybeAssigned); |
3418 // TODO(sigurds) Figure out if is_used should survive context serialization. | 3418 // TODO(sigurds) Figure out if is_used should survive context serialization. |
(...skipping 27 matching lines...) Expand all Loading... |
3446 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); | 3446 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); |
3447 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); | 3447 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); |
3448 i::Context* context = f->context(); | 3448 i::Context* context = f->context(); |
3449 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); | 3449 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); |
3450 avf.Internalize(isolate); | 3450 avf.Internalize(isolate); |
3451 | 3451 |
3452 i::DeclarationScope* script_scope = | 3452 i::DeclarationScope* script_scope = |
3453 new (&zone) i::DeclarationScope(&zone, &avf); | 3453 new (&zone) i::DeclarationScope(&zone, &avf); |
3454 i::Scope* s = i::Scope::DeserializeScopeChain( | 3454 i::Scope* s = i::Scope::DeserializeScopeChain( |
3455 isolate, &zone, context, script_scope, &avf, | 3455 isolate, &zone, context, script_scope, &avf, |
3456 i::Scope::DeserializationMode::kKeepScopeInfo); | 3456 i::Scope::DeserializationMode::kIncludingVariables); |
3457 CHECK(s != script_scope); | 3457 CHECK(s != script_scope); |
3458 const i::AstRawString* name_x = avf.GetOneByteString("x"); | 3458 const i::AstRawString* name_x = avf.GetOneByteString("x"); |
3459 | 3459 |
3460 // Get result from f's function context (that is g's outer context) | 3460 // Get result from f's function context (that is g's outer context) |
3461 i::Variable* var_x = s->Lookup(name_x); | 3461 i::Variable* var_x = s->Lookup(name_x); |
3462 CHECK(var_x != NULL); | 3462 CHECK(var_x != NULL); |
3463 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned); | 3463 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned); |
3464 } | 3464 } |
3465 | 3465 |
3466 | 3466 |
(...skipping 4881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8348 const char* data[] = { | 8348 const char* data[] = { |
8349 "const arguments = 1", | 8349 "const arguments = 1", |
8350 "let arguments", | 8350 "let arguments", |
8351 "var arguments", | 8351 "var arguments", |
8352 NULL | 8352 NULL |
8353 }; | 8353 }; |
8354 // clang-format on | 8354 // clang-format on |
8355 RunParserSyncTest(context_data, data, kSuccess); | 8355 RunParserSyncTest(context_data, data, kSuccess); |
8356 } | 8356 } |
8357 } | 8357 } |
OLD | NEW |