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 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3101 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); | 3101 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); |
3102 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); | 3102 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); |
3103 i::Context* context = f->context(); | 3103 i::Context* context = f->context(); |
3104 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); | 3104 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); |
3105 avf.Internalize(isolate); | 3105 avf.Internalize(isolate); |
3106 const i::AstRawString* name = avf.GetOneByteString("result"); | 3106 const i::AstRawString* name = avf.GetOneByteString("result"); |
3107 i::Handle<i::String> str = name->string(); | 3107 i::Handle<i::String> str = name->string(); |
3108 CHECK(str->IsInternalizedString()); | 3108 CHECK(str->IsInternalizedString()); |
3109 i::Scope* script_scope = | 3109 i::Scope* script_scope = |
3110 new (&zone) i::Scope(NULL, i::SCRIPT_SCOPE, &avf, &zone); | 3110 new (&zone) i::Scope(NULL, i::SCRIPT_SCOPE, &avf, &zone); |
3111 script_scope->Initialize(); | 3111 script_scope->Initialize(false); |
arv (Not doing code reviews)
2015/01/23 15:40:46
maybe even use a default param here since this fal
Dmitry Lomov (no reviews)
2015/01/23 21:08:28
Done.
| |
3112 i::Scope* s = i::Scope::DeserializeScopeChain(context, script_scope, &zone); | 3112 i::Scope* s = i::Scope::DeserializeScopeChain(context, script_scope, &zone); |
3113 DCHECK(s != script_scope); | 3113 DCHECK(s != script_scope); |
3114 DCHECK(name != NULL); | 3114 DCHECK(name != NULL); |
3115 | 3115 |
3116 // Get result from h's function context (that is f's context) | 3116 // Get result from h's function context (that is f's context) |
3117 i::Variable* var = s->Lookup(name); | 3117 i::Variable* var = s->Lookup(name); |
3118 | 3118 |
3119 CHECK(var != NULL); | 3119 CHECK(var != NULL); |
3120 // Maybe assigned should survive deserialization | 3120 // Maybe assigned should survive deserialization |
3121 CHECK(var->maybe_assigned() == i::kMaybeAssigned); | 3121 CHECK(var->maybe_assigned() == i::kMaybeAssigned); |
(...skipping 26 matching lines...) Expand all Loading... | |
3148 i::Zone zone(isolate); | 3148 i::Zone zone(isolate); |
3149 v8::Local<v8::Value> v = CompileRun(src); | 3149 v8::Local<v8::Value> v = CompileRun(src); |
3150 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); | 3150 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); |
3151 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); | 3151 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); |
3152 i::Context* context = f->context(); | 3152 i::Context* context = f->context(); |
3153 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); | 3153 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); |
3154 avf.Internalize(isolate); | 3154 avf.Internalize(isolate); |
3155 | 3155 |
3156 i::Scope* script_scope = | 3156 i::Scope* script_scope = |
3157 new (&zone) i::Scope(NULL, i::SCRIPT_SCOPE, &avf, &zone); | 3157 new (&zone) i::Scope(NULL, i::SCRIPT_SCOPE, &avf, &zone); |
3158 script_scope->Initialize(); | 3158 script_scope->Initialize(false); |
3159 i::Scope* s = i::Scope::DeserializeScopeChain(context, script_scope, &zone); | 3159 i::Scope* s = i::Scope::DeserializeScopeChain(context, script_scope, &zone); |
3160 DCHECK(s != script_scope); | 3160 DCHECK(s != script_scope); |
3161 const i::AstRawString* name_x = avf.GetOneByteString("x"); | 3161 const i::AstRawString* name_x = avf.GetOneByteString("x"); |
3162 | 3162 |
3163 // Get result from f's function context (that is g's outer context) | 3163 // Get result from f's function context (that is g's outer context) |
3164 i::Variable* var_x = s->Lookup(name_x); | 3164 i::Variable* var_x = s->Lookup(name_x); |
3165 CHECK(var_x != NULL); | 3165 CHECK(var_x != NULL); |
3166 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned); | 3166 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned); |
3167 } | 3167 } |
3168 | 3168 |
(...skipping 26 matching lines...) Expand all Loading... | |
3195 i::Zone zone(isolate); | 3195 i::Zone zone(isolate); |
3196 v8::Local<v8::Value> v = CompileRun(src); | 3196 v8::Local<v8::Value> v = CompileRun(src); |
3197 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); | 3197 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); |
3198 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); | 3198 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); |
3199 i::Context* context = f->context(); | 3199 i::Context* context = f->context(); |
3200 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); | 3200 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); |
3201 avf.Internalize(isolate); | 3201 avf.Internalize(isolate); |
3202 | 3202 |
3203 i::Scope* script_scope = | 3203 i::Scope* script_scope = |
3204 new (&zone) i::Scope(NULL, i::SCRIPT_SCOPE, &avf, &zone); | 3204 new (&zone) i::Scope(NULL, i::SCRIPT_SCOPE, &avf, &zone); |
3205 script_scope->Initialize(); | 3205 script_scope->Initialize(false); |
3206 i::Scope* s = i::Scope::DeserializeScopeChain(context, script_scope, &zone); | 3206 i::Scope* s = i::Scope::DeserializeScopeChain(context, script_scope, &zone); |
3207 DCHECK(s != script_scope); | 3207 DCHECK(s != script_scope); |
3208 const i::AstRawString* name_x = avf.GetOneByteString("x"); | 3208 const i::AstRawString* name_x = avf.GetOneByteString("x"); |
3209 const i::AstRawString* name_f = avf.GetOneByteString("f"); | 3209 const i::AstRawString* name_f = avf.GetOneByteString("f"); |
3210 const i::AstRawString* name_y = avf.GetOneByteString("y"); | 3210 const i::AstRawString* name_y = avf.GetOneByteString("y"); |
3211 const i::AstRawString* name_B = avf.GetOneByteString("B"); | 3211 const i::AstRawString* name_B = avf.GetOneByteString("B"); |
3212 const i::AstRawString* name_C = avf.GetOneByteString("C"); | 3212 const i::AstRawString* name_C = avf.GetOneByteString("C"); |
3213 | 3213 |
3214 // Get result from h's function context (that is f's context) | 3214 // Get result from h's function context (that is f's context) |
3215 i::Variable* var_x = s->Lookup(name_x); | 3215 i::Variable* var_x = s->Lookup(name_x); |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4658 | 4658 |
4659 static const ParserFlag always_flags[] = { | 4659 static const ParserFlag always_flags[] = { |
4660 kAllowHarmonyClasses, | 4660 kAllowHarmonyClasses, |
4661 kAllowHarmonyComputedPropertyNames, | 4661 kAllowHarmonyComputedPropertyNames, |
4662 kAllowHarmonyObjectLiterals, | 4662 kAllowHarmonyObjectLiterals, |
4663 kAllowHarmonySloppy, | 4663 kAllowHarmonySloppy, |
4664 }; | 4664 }; |
4665 RunParserSyncTest(context_data, error_data, kError, NULL, 0, | 4665 RunParserSyncTest(context_data, error_data, kError, NULL, 0, |
4666 always_flags, arraysize(always_flags)); | 4666 always_flags, arraysize(always_flags)); |
4667 } | 4667 } |
OLD | NEW |