Index: src/parsing/parser.h |
diff --git a/src/parsing/parser.h b/src/parsing/parser.h |
index b1a0c1a9c0716a55c549b534a3f9c46a408f2b6c..bc6f7044bac7c7d927f53adc32f14e201d4f2dd9 100644 |
--- a/src/parsing/parser.h |
+++ b/src/parsing/parser.h |
@@ -31,11 +31,11 @@ class FunctionEntry BASE_EMBEDDED { |
enum { |
kStartPositionIndex, |
kEndPositionIndex, |
+ kNumParametersIndex, |
+ kFunctionLengthIndex, |
kLiteralCountIndex, |
kPropertyCountIndex, |
- kLanguageModeIndex, |
- kUsesSuperPropertyIndex, |
- kCallsEvalIndex, |
+ kFlagsIndex, |
kSize |
}; |
@@ -44,18 +44,43 @@ class FunctionEntry BASE_EMBEDDED { |
FunctionEntry() : backing_() { } |
- int start_pos() { return backing_[kStartPositionIndex]; } |
- int end_pos() { return backing_[kEndPositionIndex]; } |
- int literal_count() { return backing_[kLiteralCountIndex]; } |
- int property_count() { return backing_[kPropertyCountIndex]; } |
- LanguageMode language_mode() { |
- DCHECK(is_valid_language_mode(backing_[kLanguageModeIndex])); |
- return static_cast<LanguageMode>(backing_[kLanguageModeIndex]); |
+ class LanguageModeField : public BitField<LanguageMode, 0, 1> {}; |
+ class UsesSuperPropertyField |
+ : public BitField<bool, LanguageModeField::kNext, 1> {}; |
+ class CallsEvalField |
+ : public BitField<bool, UsesSuperPropertyField::kNext, 1> {}; |
+ class HasDuplicateParametersField |
+ : public BitField<bool, CallsEvalField::kNext, 1> {}; |
+ |
+ static uint32_t EncodeFlags(LanguageMode language_mode, |
+ bool uses_super_property, bool calls_eval, |
+ bool has_duplicate_parameters) { |
+ return LanguageModeField::encode(language_mode) | |
+ UsesSuperPropertyField::encode(uses_super_property) | |
+ CallsEvalField::encode(calls_eval) | |
+ HasDuplicateParametersField::encode(has_duplicate_parameters); |
+ } |
+ |
+ int start_pos() const { return backing_[kStartPositionIndex]; } |
+ int end_pos() const { return backing_[kEndPositionIndex]; } |
+ int num_parameters() const { return backing_[kNumParametersIndex]; } |
+ int function_length() const { return backing_[kFunctionLengthIndex]; } |
+ int literal_count() const { return backing_[kLiteralCountIndex]; } |
+ int property_count() const { return backing_[kPropertyCountIndex]; } |
+ LanguageMode language_mode() const { |
+ return LanguageModeField::decode(backing_[kFlagsIndex]); |
+ } |
+ bool uses_super_property() const { |
+ return UsesSuperPropertyField::decode(backing_[kFlagsIndex]); |
+ } |
+ bool calls_eval() const { |
+ return CallsEvalField::decode(backing_[kFlagsIndex]); |
+ } |
+ bool has_duplicate_parameters() const { |
+ return HasDuplicateParametersField::decode(backing_[kFlagsIndex]); |
} |
- bool uses_super_property() { return backing_[kUsesSuperPropertyIndex]; } |
- bool calls_eval() { return backing_[kCallsEvalIndex]; } |
- bool is_valid() { return !backing_.is_empty(); } |
+ bool is_valid() const { return !backing_.is_empty(); } |
private: |
Vector<unsigned> backing_; |
@@ -490,13 +515,17 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { |
// by parsing the function with PreParser. Consumes the ending }. |
// If may_abort == true, the (pre-)parser may decide to abort skipping |
// in order to force the function to be eagerly parsed, after all. |
- LazyParsingResult SkipLazyFunctionBody(int* materialized_literal_count, |
- int* expected_property_count, |
- bool is_inner_function, bool may_abort, |
- bool* ok); |
- |
- PreParser::PreParseResult ParseFunctionBodyWithPreParser( |
- SingletonLogger* logger, bool is_inner_function, bool may_abort); |
+ LazyParsingResult SkipFunction( |
+ FunctionKind kind, DeclarationScope* function_scope, int* num_parameters, |
+ int* function_length, bool* has_duplicate_parameters, |
+ int* materialized_literal_count, int* expected_property_count, |
+ bool is_inner_function, bool may_abort, bool* ok); |
+ |
+ PreParser::PreParseResult ParseFunctionWithPreParser(FunctionKind kind, |
+ DeclarationScope* scope, |
+ SingletonLogger* logger, |
+ bool is_inner_function, |
+ bool may_abort); |
Block* BuildParameterInitializationBlock( |
const ParserFormalParameters& parameters, bool* ok); |
@@ -508,6 +537,13 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { |
const ParserFormalParameters& parameters, FunctionKind kind, |
FunctionLiteral::FunctionType function_type, bool* ok); |
+ ZoneList<Statement*>* ParseFunction( |
+ const AstRawString* function_name, int pos, FunctionKind kind, |
+ FunctionLiteral::FunctionType function_type, |
+ DeclarationScope* function_scope, int* num_parameters, |
+ int* function_length, bool* has_duplicate_parameters, |
+ int* materialized_literal_count, int* expected_property_count, bool* ok); |
+ |
void ThrowPendingError(Isolate* isolate, Handle<Script> script); |
class TemplateLiteral : public ZoneObject { |