OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/builtins.h" | 10 #include "src/builtins.h" |
(...skipping 7020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7031 // on the object (the one the id is set for), and a label. | 7031 // on the object (the one the id is set for), and a label. |
7032 // | 7032 // |
7033 // Installation of ids for the selected builtin functions is handled | 7033 // Installation of ids for the selected builtin functions is handled |
7034 // by the bootstrapper. | 7034 // by the bootstrapper. |
7035 #define FUNCTIONS_WITH_ID_LIST(V) \ | 7035 #define FUNCTIONS_WITH_ID_LIST(V) \ |
7036 V(Array.prototype, indexOf, ArrayIndexOf) \ | 7036 V(Array.prototype, indexOf, ArrayIndexOf) \ |
7037 V(Array.prototype, lastIndexOf, ArrayLastIndexOf) \ | 7037 V(Array.prototype, lastIndexOf, ArrayLastIndexOf) \ |
7038 V(Array.prototype, push, ArrayPush) \ | 7038 V(Array.prototype, push, ArrayPush) \ |
7039 V(Array.prototype, pop, ArrayPop) \ | 7039 V(Array.prototype, pop, ArrayPop) \ |
7040 V(Array.prototype, shift, ArrayShift) \ | 7040 V(Array.prototype, shift, ArrayShift) \ |
| 7041 V(Array.prototype, slice, ArraySlice) \ |
7041 V(Function.prototype, apply, FunctionApply) \ | 7042 V(Function.prototype, apply, FunctionApply) \ |
| 7043 V(Function.prototype, call, FunctionCall) \ |
7042 V(String.prototype, charCodeAt, StringCharCodeAt) \ | 7044 V(String.prototype, charCodeAt, StringCharCodeAt) \ |
7043 V(String.prototype, charAt, StringCharAt) \ | 7045 V(String.prototype, charAt, StringCharAt) \ |
7044 V(String, fromCharCode, StringFromCharCode) \ | 7046 V(String, fromCharCode, StringFromCharCode) \ |
7045 V(Math, floor, MathFloor) \ | 7047 V(Math, floor, MathFloor) \ |
7046 V(Math, round, MathRound) \ | 7048 V(Math, round, MathRound) \ |
7047 V(Math, ceil, MathCeil) \ | 7049 V(Math, ceil, MathCeil) \ |
7048 V(Math, abs, MathAbs) \ | 7050 V(Math, abs, MathAbs) \ |
7049 V(Math, log, MathLog) \ | 7051 V(Math, log, MathLog) \ |
7050 V(Math, exp, MathExp) \ | 7052 V(Math, exp, MathExp) \ |
7051 V(Math, sqrt, MathSqrt) \ | 7053 V(Math, sqrt, MathSqrt) \ |
7052 V(Math, pow, MathPow) \ | 7054 V(Math, pow, MathPow) \ |
7053 V(Math, max, MathMax) \ | 7055 V(Math, max, MathMax) \ |
7054 V(Math, min, MathMin) \ | 7056 V(Math, min, MathMin) \ |
7055 V(Math, imul, MathImul) | 7057 V(Math, imul, MathImul) |
7056 | 7058 |
7057 enum BuiltinFunctionId { | 7059 enum BuiltinFunctionId { |
7058 kArrayCode, | 7060 kArrayCode, |
7059 #define DECLARE_FUNCTION_ID(ignored1, ignore2, name) \ | 7061 #define DECLARE_FUNCTION_ID(ignored1, ignore2, name) \ |
7060 k##name, | 7062 k##name, |
7061 FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID) | 7063 FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID) |
7062 #undef DECLARE_FUNCTION_ID | 7064 #undef DECLARE_FUNCTION_ID |
7063 // Fake id for a special case of Math.pow. Note, it continues the | 7065 // Fake id for a special case of Math.pow. Note, it continues the |
7064 // list of math functions. | 7066 // list of math functions. |
7065 kMathPowHalf, | 7067 kMathPowHalf, |
7066 // Installed only on --harmony-maths. | 7068 // Installed only on --harmony-maths. |
7067 kMathClz32 | 7069 kMathClz32, |
| 7070 |
| 7071 kBuiltinsLength |
7068 }; | 7072 }; |
7069 | 7073 |
7070 | 7074 |
7071 // SharedFunctionInfo describes the JSFunction information that can be | 7075 // SharedFunctionInfo describes the JSFunction information that can be |
7072 // shared by multiple instances of the function. | 7076 // shared by multiple instances of the function. |
7073 class SharedFunctionInfo: public HeapObject { | 7077 class SharedFunctionInfo: public HeapObject { |
7074 public: | 7078 public: |
7075 // [name]: Function name. | 7079 // [name]: Function name. |
7076 DECL_ACCESSORS(name, Object) | 7080 DECL_ACCESSORS(name, Object) |
7077 | 7081 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7214 DECL_BOOLEAN_ACCESSORS(is_expression) | 7218 DECL_BOOLEAN_ACCESSORS(is_expression) |
7215 | 7219 |
7216 // Is this function a top-level function (scripts, evals). | 7220 // Is this function a top-level function (scripts, evals). |
7217 DECL_BOOLEAN_ACCESSORS(is_toplevel) | 7221 DECL_BOOLEAN_ACCESSORS(is_toplevel) |
7218 | 7222 |
7219 // Bit field containing various information collected by the compiler to | 7223 // Bit field containing various information collected by the compiler to |
7220 // drive optimization. | 7224 // drive optimization. |
7221 inline int compiler_hints(); | 7225 inline int compiler_hints(); |
7222 inline void set_compiler_hints(int value); | 7226 inline void set_compiler_hints(int value); |
7223 | 7227 |
| 7228 // Whether the function should use optimistic optimizations that |
| 7229 // cannot be easily ensured to work due to e.g. lack of type feedback |
| 7230 inline bool use_optimistic_optimizations(); |
| 7231 inline void disable_optimistic_optimizations(); |
| 7232 DECL_BOOLEAN_ACCESSORS(optimistic_optimizations) |
| 7233 |
7224 inline int ast_node_count(); | 7234 inline int ast_node_count(); |
7225 inline void set_ast_node_count(int count); | 7235 inline void set_ast_node_count(int count); |
7226 | 7236 |
7227 inline int profiler_ticks(); | 7237 inline int profiler_ticks(); |
7228 inline void set_profiler_ticks(int ticks); | 7238 inline void set_profiler_ticks(int ticks); |
7229 | 7239 |
7230 // Inline cache age is used to infer whether the function survived a context | 7240 // Inline cache age is used to infer whether the function survived a context |
7231 // disposal or not. In the former case we reset the opt_count. | 7241 // disposal or not. In the former case we reset the opt_count. |
7232 inline int ic_age(); | 7242 inline int ic_age(); |
7233 inline void set_ic_age(int age); | 7243 inline void set_ic_age(int age); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7498 kInlineBuiltin, | 7508 kInlineBuiltin, |
7499 kBoundFunction, | 7509 kBoundFunction, |
7500 kIsAnonymous, | 7510 kIsAnonymous, |
7501 kNameShouldPrintAsAnonymous, | 7511 kNameShouldPrintAsAnonymous, |
7502 kIsFunction, | 7512 kIsFunction, |
7503 kDontOptimize, | 7513 kDontOptimize, |
7504 kDontInline, | 7514 kDontInline, |
7505 kDontCache, | 7515 kDontCache, |
7506 kDontFlush, | 7516 kDontFlush, |
7507 kIsGenerator, | 7517 kIsGenerator, |
| 7518 kOptimisticOptimizations, |
7508 kCompilerHintsCount // Pseudo entry | 7519 kCompilerHintsCount // Pseudo entry |
7509 }; | 7520 }; |
7510 | 7521 |
7511 class DeoptCountBits: public BitField<int, 0, 4> {}; | 7522 class DeoptCountBits: public BitField<int, 0, 4> {}; |
7512 class OptReenableTriesBits: public BitField<int, 4, 18> {}; | 7523 class OptReenableTriesBits: public BitField<int, 4, 18> {}; |
7513 class ICAgeBits: public BitField<int, 22, 8> {}; | 7524 class ICAgeBits: public BitField<int, 22, 8> {}; |
7514 | 7525 |
7515 class OptCountBits: public BitField<int, 0, 22> {}; | 7526 class OptCountBits: public BitField<int, 0, 22> {}; |
7516 class DisabledOptimizationReasonBits: public BitField<int, 22, 8> {}; | 7527 class DisabledOptimizationReasonBits: public BitField<int, 22, 8> {}; |
7517 | 7528 |
(...skipping 3731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11249 } else { | 11260 } else { |
11250 value &= ~(1 << bit_position); | 11261 value &= ~(1 << bit_position); |
11251 } | 11262 } |
11252 return value; | 11263 return value; |
11253 } | 11264 } |
11254 }; | 11265 }; |
11255 | 11266 |
11256 } } // namespace v8::internal | 11267 } } // namespace v8::internal |
11257 | 11268 |
11258 #endif // V8_OBJECTS_H_ | 11269 #endif // V8_OBJECTS_H_ |
OLD | NEW |