Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PARSING_PARSE_INFO_H_ | 5 #ifndef V8_PARSING_PARSE_INFO_H_ |
| 6 #define V8_PARSING_PARSE_INFO_H_ | 6 #define V8_PARSING_PARSE_INFO_H_ |
| 7 | 7 |
| 8 #include "include/v8.h" | 8 #include "include/v8.h" |
| 9 #include "src/globals.h" | 9 #include "src/globals.h" |
| 10 #include "src/handles.h" | 10 #include "src/handles.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 bool is_async() const; | 152 bool is_async() const; |
| 153 bool is_default_constructor() const; | 153 bool is_default_constructor() const; |
| 154 FunctionKind function_kind() const; | 154 FunctionKind function_kind() const; |
| 155 | 155 |
| 156 //-------------------------------------------------------------------------- | 156 //-------------------------------------------------------------------------- |
| 157 // TODO(titzer): these should not be part of ParseInfo. | 157 // TODO(titzer): these should not be part of ParseInfo. |
| 158 //-------------------------------------------------------------------------- | 158 //-------------------------------------------------------------------------- |
| 159 Isolate* isolate() const { return isolate_; } | 159 Isolate* isolate() const { return isolate_; } |
| 160 Handle<SharedFunctionInfo> shared_info() const { return shared_; } | 160 Handle<SharedFunctionInfo> shared_info() const { return shared_; } |
| 161 Handle<Script> script() const { return script_; } | 161 Handle<Script> script() const { return script_; } |
| 162 Handle<Context> context() const { return context_; } | 162 MaybeHandle<ScopeInfo> maybe_outer_scope_info() const { |
| 163 return maybe_outer_scope_info_; | |
| 164 } | |
| 163 void clear_script() { script_ = Handle<Script>::null(); } | 165 void clear_script() { script_ = Handle<Script>::null(); } |
| 164 void set_isolate(Isolate* isolate) { isolate_ = isolate; } | 166 void set_isolate(Isolate* isolate) { isolate_ = isolate; } |
| 165 void set_shared_info(Handle<SharedFunctionInfo> shared) { shared_ = shared; } | 167 void set_shared_info(Handle<SharedFunctionInfo> shared) { shared_ = shared; } |
| 166 void set_context(Handle<Context> context) { context_ = context; } | 168 void set_outer_scope_info(Handle<ScopeInfo> outer_scope_info) { |
|
jgruber
2016/09/14 11:44:56
Since this is always called with the same
if (!c
jochen (gone - plz use gerrit)
2016/09/14 11:48:34
eventually, the compiler dispatcher will only have
| |
| 169 maybe_outer_scope_info_ = outer_scope_info; | |
| 170 } | |
| 167 void set_script(Handle<Script> script) { script_ = script; } | 171 void set_script(Handle<Script> script) { script_ = script; } |
| 168 //-------------------------------------------------------------------------- | 172 //-------------------------------------------------------------------------- |
| 169 | 173 |
| 170 LanguageMode language_mode() const { | 174 LanguageMode language_mode() const { |
| 171 return construct_language_mode(is_strict_mode()); | 175 return construct_language_mode(is_strict_mode()); |
| 172 } | 176 } |
| 173 void set_language_mode(LanguageMode language_mode) { | 177 void set_language_mode(LanguageMode language_mode) { |
| 174 STATIC_ASSERT(LANGUAGE_END == 2); | 178 STATIC_ASSERT(LANGUAGE_END == 2); |
| 175 set_strict_mode(is_strict(language_mode)); | 179 set_strict_mode(is_strict(language_mode)); |
| 176 } | 180 } |
| 177 | 181 |
| 178 void ReopenHandlesInNewHandleScope() { | 182 void ReopenHandlesInNewHandleScope() { |
| 179 shared_ = Handle<SharedFunctionInfo>(*shared_); | 183 shared_ = Handle<SharedFunctionInfo>(*shared_); |
| 180 script_ = Handle<Script>(*script_); | 184 script_ = Handle<Script>(*script_); |
| 181 context_ = Handle<Context>(*context_); | 185 Handle<ScopeInfo> outer_scope_info; |
| 186 if (maybe_outer_scope_info_.ToHandle(&outer_scope_info)) { | |
| 187 maybe_outer_scope_info_ = Handle<ScopeInfo>(*outer_scope_info); | |
| 188 } | |
| 182 } | 189 } |
| 183 | 190 |
| 184 #ifdef DEBUG | 191 #ifdef DEBUG |
| 185 bool script_is_native() const; | 192 bool script_is_native() const; |
| 186 #endif // DEBUG | 193 #endif // DEBUG |
| 187 | 194 |
| 188 private: | 195 private: |
| 189 // Various configuration flags for parsing. | 196 // Various configuration flags for parsing. |
| 190 enum Flag { | 197 enum Flag { |
| 191 // ---------- Input flags --------------------------- | 198 // ---------- Input flags --------------------------- |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 217 uintptr_t stack_limit_; | 224 uintptr_t stack_limit_; |
| 218 uint32_t hash_seed_; | 225 uint32_t hash_seed_; |
| 219 int compiler_hints_; | 226 int compiler_hints_; |
| 220 int start_position_; | 227 int start_position_; |
| 221 int end_position_; | 228 int end_position_; |
| 222 | 229 |
| 223 // TODO(titzer): Move handles and isolate out of ParseInfo. | 230 // TODO(titzer): Move handles and isolate out of ParseInfo. |
| 224 Isolate* isolate_; | 231 Isolate* isolate_; |
| 225 Handle<SharedFunctionInfo> shared_; | 232 Handle<SharedFunctionInfo> shared_; |
| 226 Handle<Script> script_; | 233 Handle<Script> script_; |
| 227 Handle<Context> context_; | 234 MaybeHandle<ScopeInfo> maybe_outer_scope_info_; |
| 228 | 235 |
| 229 //----------- Inputs+Outputs of parsing and scope analysis ----------------- | 236 //----------- Inputs+Outputs of parsing and scope analysis ----------------- |
| 230 ScriptData** cached_data_; // used if available, populated if requested. | 237 ScriptData** cached_data_; // used if available, populated if requested. |
| 231 AstValueFactory* ast_value_factory_; // used if available, otherwise new. | 238 AstValueFactory* ast_value_factory_; // used if available, otherwise new. |
| 232 const AstRawString* function_name_; | 239 const AstRawString* function_name_; |
| 233 | 240 |
| 234 //----------- Output of parsing and scope analysis ------------------------ | 241 //----------- Output of parsing and scope analysis ------------------------ |
| 235 FunctionLiteral* literal_; | 242 FunctionLiteral* literal_; |
| 236 | 243 |
| 237 void SetFlag(Flag f) { flags_ |= f; } | 244 void SetFlag(Flag f) { flags_ |= f; } |
| 238 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } | 245 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } |
| 239 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } | 246 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } |
| 240 }; | 247 }; |
| 241 | 248 |
| 242 } // namespace internal | 249 } // namespace internal |
| 243 } // namespace v8 | 250 } // namespace v8 |
| 244 | 251 |
| 245 #endif // V8_PARSING_PARSE_INFO_H_ | 252 #endif // V8_PARSING_PARSE_INFO_H_ |
| OLD | NEW |