Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1501)

Side by Side Diff: src/ast.h

Issue 25473002: Defer allocation of native function literals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Pass along extension object in AST node. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 V(WhileStatement) \ 90 V(WhileStatement) \
91 V(ForStatement) \ 91 V(ForStatement) \
92 V(ForInStatement) \ 92 V(ForInStatement) \
93 V(ForOfStatement) \ 93 V(ForOfStatement) \
94 V(TryCatchStatement) \ 94 V(TryCatchStatement) \
95 V(TryFinallyStatement) \ 95 V(TryFinallyStatement) \
96 V(DebuggerStatement) 96 V(DebuggerStatement)
97 97
98 #define EXPRESSION_NODE_LIST(V) \ 98 #define EXPRESSION_NODE_LIST(V) \
99 V(FunctionLiteral) \ 99 V(FunctionLiteral) \
100 V(SharedFunctionInfoLiteral) \ 100 V(NativeFunctionLiteral) \
101 V(Conditional) \ 101 V(Conditional) \
102 V(VariableProxy) \ 102 V(VariableProxy) \
103 V(Literal) \ 103 V(Literal) \
104 V(RegExpLiteral) \ 104 V(RegExpLiteral) \
105 V(ObjectLiteral) \ 105 V(ObjectLiteral) \
106 V(ArrayLiteral) \ 106 V(ArrayLiteral) \
107 V(Assignment) \ 107 V(Assignment) \
108 V(Yield) \ 108 V(Yield) \
109 V(Throw) \ 109 V(Throw) \
110 V(Property) \ 110 V(Property) \
(...skipping 2262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 class IsExpression: public BitField<bool, 0, 1> {}; 2373 class IsExpression: public BitField<bool, 0, 1> {};
2374 class IsAnonymous: public BitField<bool, 1, 1> {}; 2374 class IsAnonymous: public BitField<bool, 1, 1> {};
2375 class Pretenure: public BitField<bool, 2, 1> {}; 2375 class Pretenure: public BitField<bool, 2, 1> {};
2376 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; 2376 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {};
2377 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; 2377 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {};
2378 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; 2378 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {};
2379 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {}; 2379 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {};
2380 }; 2380 };
2381 2381
2382 2382
2383 class SharedFunctionInfoLiteral V8_FINAL : public Expression { 2383 class NativeFunctionLiteral V8_FINAL : public Expression {
2384 public: 2384 public:
2385 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) 2385 DECLARE_NODE_TYPE(NativeFunctionLiteral)
2386 2386
2387 Handle<SharedFunctionInfo> shared_function_info() const { 2387 Handle<String> name() const { return name_; }
2388 return shared_function_info_; 2388 v8::Extension* extension() const { return extension_; }
2389 }
2390 2389
2391 protected: 2390 protected:
2392 SharedFunctionInfoLiteral( 2391 NativeFunctionLiteral(
2393 Isolate* isolate, 2392 Isolate* isolate, Handle<String> name, v8::Extension* extension)
2394 Handle<SharedFunctionInfo> shared_function_info) 2393 : Expression(isolate), name_(name), extension_(extension) { }
2395 : Expression(isolate),
2396 shared_function_info_(shared_function_info) { }
2397 2394
2398 private: 2395 private:
2399 Handle<SharedFunctionInfo> shared_function_info_; 2396 Handle<String> name_;
2397 v8::Extension* extension_;
2400 }; 2398 };
2401 2399
2402 2400
2403 class ThisFunction V8_FINAL : public Expression { 2401 class ThisFunction V8_FINAL : public Expression {
2404 public: 2402 public:
2405 DECLARE_NODE_TYPE(ThisFunction) 2403 DECLARE_NODE_TYPE(ThisFunction)
2406 2404
2407 protected: 2405 protected:
2408 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} 2406 explicit ThisFunction(Isolate* isolate): Expression(isolate) {}
2409 }; 2407 };
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
3230 materialized_literal_count, expected_property_count, handler_count, 3228 materialized_literal_count, expected_property_count, handler_count,
3231 parameter_count, function_type, has_duplicate_parameters, is_function, 3229 parameter_count, function_type, has_duplicate_parameters, is_function,
3232 is_parenthesized, is_generator); 3230 is_parenthesized, is_generator);
3233 // Top-level literal doesn't count for the AST's properties. 3231 // Top-level literal doesn't count for the AST's properties.
3234 if (is_function == FunctionLiteral::kIsFunction) { 3232 if (is_function == FunctionLiteral::kIsFunction) {
3235 visitor_.VisitFunctionLiteral(lit); 3233 visitor_.VisitFunctionLiteral(lit);
3236 } 3234 }
3237 return lit; 3235 return lit;
3238 } 3236 }
3239 3237
3240 SharedFunctionInfoLiteral* NewSharedFunctionInfoLiteral( 3238 NativeFunctionLiteral* NewNativeFunctionLiteral(Handle<String> name,
3241 Handle<SharedFunctionInfo> shared_function_info) { 3239 v8::Extension* extension) {
3242 SharedFunctionInfoLiteral* lit = 3240 NativeFunctionLiteral* lit =
3243 new(zone_) SharedFunctionInfoLiteral(isolate_, shared_function_info); 3241 new(zone_) NativeFunctionLiteral(isolate_, name, extension);
3244 VISIT_AND_RETURN(SharedFunctionInfoLiteral, lit) 3242 VISIT_AND_RETURN(NativeFunctionLiteral, lit)
3245 } 3243 }
3246 3244
3247 ThisFunction* NewThisFunction() { 3245 ThisFunction* NewThisFunction() {
3248 ThisFunction* fun = new(zone_) ThisFunction(isolate_); 3246 ThisFunction* fun = new(zone_) ThisFunction(isolate_);
3249 VISIT_AND_RETURN(ThisFunction, fun) 3247 VISIT_AND_RETURN(ThisFunction, fun)
3250 } 3248 }
3251 3249
3252 #undef VISIT_AND_RETURN 3250 #undef VISIT_AND_RETURN
3253 3251
3254 private: 3252 private:
3255 Isolate* isolate_; 3253 Isolate* isolate_;
3256 Zone* zone_; 3254 Zone* zone_;
3257 Visitor visitor_; 3255 Visitor visitor_;
3258 }; 3256 };
3259 3257
3260 3258
3261 } } // namespace v8::internal 3259 } } // namespace v8::internal
3262 3260
3263 #endif // V8_AST_H_ 3261 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698