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

Unified Diff: src/ast/compile-time-value.h

Issue 2305883002: Remove unnessary includes of parser.h (Closed)
Patch Set: More fixes in asm-js.h Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/ast.cc ('k') | src/ast/compile-time-value.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/compile-time-value.h
diff --git a/src/ast/compile-time-value.h b/src/ast/compile-time-value.h
new file mode 100644
index 0000000000000000000000000000000000000000..27351b79cc0b3784063b3757c46c5f26170e8c0c
--- /dev/null
+++ b/src/ast/compile-time-value.h
@@ -0,0 +1,45 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_AST_COMPILE_TIME_VALUE
+#define V8_AST_COMPILE_TIME_VALUE
+
+#include "src/allocation.h"
+#include "src/globals.h"
+
+namespace v8 {
+namespace internal {
+
+class Expression;
+
+// Support for handling complex values (array and object literals) that
+// can be fully handled at compile time.
+class CompileTimeValue : public AllStatic {
+ public:
+ enum LiteralType {
+ OBJECT_LITERAL_FAST_ELEMENTS,
+ OBJECT_LITERAL_SLOW_ELEMENTS,
+ ARRAY_LITERAL
+ };
+
+ static bool IsCompileTimeValue(Expression* expression);
+
+ // Get the value as a compile time value.
+ static Handle<FixedArray> GetValue(Isolate* isolate, Expression* expression);
+
+ // Get the type of a compile time value returned by GetValue().
+ static LiteralType GetLiteralType(Handle<FixedArray> value);
+
+ // Get the elements array of a compile time value returned by GetValue().
+ static Handle<FixedArray> GetElements(Handle<FixedArray> value);
+
+ private:
+ static const int kLiteralTypeSlot = 0;
+ static const int kElementsSlot = 1;
+};
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_AST_COMPILE_TIME_VALUE
« no previous file with comments | « src/ast/ast.cc ('k') | src/ast/compile-time-value.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698