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

Side by Side Diff: src/ast/compile-time-value.h

Issue 2445333002: Ensure slow properties for simple {__proto__:null} literals. (Closed)
Patch Set: minor cleanup Created 3 years, 7 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_AST_COMPILE_TIME_VALUE 5 #ifndef V8_AST_COMPILE_TIME_VALUE
6 #define V8_AST_COMPILE_TIME_VALUE 6 #define V8_AST_COMPILE_TIME_VALUE
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 class Expression; 14 class Expression;
15 15
16 // Support for handling complex values (array and object literals) that 16 // Support for handling complex values (array and object literals) that
17 // can be fully handled at compile time. 17 // can be fully handled at compile time.
18 class CompileTimeValue : public AllStatic { 18 class CompileTimeValue : public AllStatic {
19 public: 19 public:
20 enum LiteralType { 20 static const int kArrayLiteralFlag = -1;
adamk 2017/04/26 18:48:15 This could use a comment, and see below.
Camillo Bruni 2017/04/27 09:39:41 Added comment + DCHECK to better explain the purpo
21 OBJECT_LITERAL_FAST_ELEMENTS,
22 OBJECT_LITERAL_SLOW_ELEMENTS,
23 ARRAY_LITERAL
24 };
25 21
26 static bool IsCompileTimeValue(Expression* expression); 22 static bool IsCompileTimeValue(Expression* expression);
27 23
28 // Get the value as a compile time value. 24 // Get the value as a compile time value.
29 static Handle<FixedArray> GetValue(Isolate* isolate, Expression* expression); 25 static Handle<FixedArray> GetValue(Isolate* isolate, Expression* expression);
30 26
31 // Get the type of a compile time value returned by GetValue(). 27 // Get the type of a compile time value returned by GetValue().
adamk 2017/04/26 18:48:14 Please update this comment to explain what this th
Camillo Bruni 2017/04/27 09:39:41 updated with explanation of where the values come
32 static LiteralType GetLiteralType(Handle<FixedArray> value); 28 static int GetLiteralTypeFlags(Handle<FixedArray> value);
33 29
34 // Get the elements of a compile time value returned by GetValue(). 30 // Get the elements of a compile time value returned by GetValue().
35 static Handle<HeapObject> GetElements(Handle<FixedArray> value); 31 static Handle<HeapObject> GetElements(Handle<FixedArray> value);
36 32
37 private: 33 private:
38 static const int kLiteralTypeSlot = 0; 34 static const int kLiteralTypeSlot = 0;
39 static const int kElementsSlot = 1; 35 static const int kElementsSlot = 1;
40 }; 36 };
41 37
42 } // namespace internal 38 } // namespace internal
43 } // namespace v8 39 } // namespace v8
44 40
45 #endif // V8_AST_COMPILE_TIME_VALUE 41 #endif // V8_AST_COMPILE_TIME_VALUE
OLDNEW
« no previous file with comments | « src/ast/ast.cc ('k') | src/ast/compile-time-value.cc » ('j') | src/factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698