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_HYDROGEN_H_ | 5 #ifndef V8_HYDROGEN_H_ |
6 #define V8_HYDROGEN_H_ | 6 #define V8_HYDROGEN_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 | 2111 |
2112 void VisitDeclarations(ZoneList<Declaration*>* declarations) OVERRIDE; | 2112 void VisitDeclarations(ZoneList<Declaration*>* declarations) OVERRIDE; |
2113 | 2113 |
2114 void* operator new(size_t size, Zone* zone) { return zone->New(size); } | 2114 void* operator new(size_t size, Zone* zone) { return zone->New(size); } |
2115 void operator delete(void* pointer, Zone* zone) { } | 2115 void operator delete(void* pointer, Zone* zone) { } |
2116 void operator delete(void* pointer) { } | 2116 void operator delete(void* pointer) { } |
2117 | 2117 |
2118 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 2118 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
2119 | 2119 |
2120 protected: | 2120 protected: |
2121 // Type of a member function that generates inline code for a native function. | |
2122 typedef void (HOptimizedGraphBuilder::*InlineFunctionGenerator) | |
2123 (CallRuntime* call); | |
2124 | |
2125 InlineFunctionGenerator FindInlineFunctionGenerator(CallRuntime* expr); | |
2126 | |
2127 // Forward declarations for inner scope classes. | 2121 // Forward declarations for inner scope classes. |
2128 class SubgraphScope; | 2122 class SubgraphScope; |
2129 | 2123 |
2130 static const InlineFunctionGenerator kInlineFunctionGenerators[]; | |
2131 | |
2132 static const int kMaxCallPolymorphism = 4; | 2124 static const int kMaxCallPolymorphism = 4; |
2133 static const int kMaxLoadPolymorphism = 4; | 2125 static const int kMaxLoadPolymorphism = 4; |
2134 static const int kMaxStorePolymorphism = 4; | 2126 static const int kMaxStorePolymorphism = 4; |
2135 | 2127 |
2136 // Even in the 'unlimited' case we have to have some limit in order not to | 2128 // Even in the 'unlimited' case we have to have some limit in order not to |
2137 // overflow the stack. | 2129 // overflow the stack. |
2138 static const int kUnlimitedMaxInlinedSourceSize = 100000; | 2130 static const int kUnlimitedMaxInlinedSourceSize = 100000; |
2139 static const int kUnlimitedMaxInlinedNodes = 10000; | 2131 static const int kUnlimitedMaxInlinedNodes = 10000; |
2140 static const int kUnlimitedMaxInlinedNodesCumulative = 10000; | 2132 static const int kUnlimitedMaxInlinedNodesCumulative = 10000; |
2141 | 2133 |
(...skipping 21 matching lines...) Expand all Loading... |
2163 TestContext* inlined_test_context() const { | 2155 TestContext* inlined_test_context() const { |
2164 return function_state()->test_context(); | 2156 return function_state()->test_context(); |
2165 } | 2157 } |
2166 void ClearInlinedTestContext() { | 2158 void ClearInlinedTestContext() { |
2167 function_state()->ClearInlinedTestContext(); | 2159 function_state()->ClearInlinedTestContext(); |
2168 } | 2160 } |
2169 LanguageMode function_language_mode() { | 2161 LanguageMode function_language_mode() { |
2170 return function_state()->compilation_info()->language_mode(); | 2162 return function_state()->compilation_info()->language_mode(); |
2171 } | 2163 } |
2172 | 2164 |
2173 // Generators for inline runtime functions. | 2165 #define FOR_EACH_HYDROGEN_INTRINSIC(F) \ |
2174 #define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \ | 2166 F(IsSmi) \ |
2175 void Generate##Name(CallRuntime* call); | 2167 F(IsNonNegativeSmi) \ |
| 2168 F(IsArray) \ |
| 2169 F(IsRegExp) \ |
| 2170 F(IsJSProxy) \ |
| 2171 F(IsConstructCall) \ |
| 2172 F(CallFunction) \ |
| 2173 F(DefaultConstructorCallSuper) \ |
| 2174 F(ArgumentsLength) \ |
| 2175 F(Arguments) \ |
| 2176 F(ValueOf) \ |
| 2177 F(SetValueOf) \ |
| 2178 F(DateField) \ |
| 2179 F(StringCharFromCode) \ |
| 2180 F(StringCharAt) \ |
| 2181 F(OneByteSeqStringSetChar) \ |
| 2182 F(TwoByteSeqStringSetChar) \ |
| 2183 F(ObjectEquals) \ |
| 2184 F(IsObject) \ |
| 2185 F(IsFunction) \ |
| 2186 F(IsUndetectableObject) \ |
| 2187 F(IsSpecObject) \ |
| 2188 F(IsStringWrapperSafeForDefaultValueOf) \ |
| 2189 F(MathPow) \ |
| 2190 F(IsMinusZero) \ |
| 2191 F(HasCachedArrayIndex) \ |
| 2192 F(GetCachedArrayIndex) \ |
| 2193 F(FastOneByteArrayJoin) \ |
| 2194 F(GeneratorNext) \ |
| 2195 F(GeneratorThrow) \ |
| 2196 F(DebugBreakInOptimizedCode) \ |
| 2197 F(ClassOf) \ |
| 2198 F(StringCharCodeAt) \ |
| 2199 F(StringAdd) \ |
| 2200 F(SubString) \ |
| 2201 F(StringCompare) \ |
| 2202 F(RegExpExec) \ |
| 2203 F(RegExpConstructResult) \ |
| 2204 F(GetFromCache) \ |
| 2205 F(NumberToString) \ |
| 2206 F(DebugIsActive) \ |
| 2207 /* Typed Arrays */ \ |
| 2208 F(TypedArrayInitialize) \ |
| 2209 F(DataViewInitialize) \ |
| 2210 F(MaxSmi) \ |
| 2211 F(TypedArrayMaxSizeInHeap) \ |
| 2212 F(ArrayBufferViewGetByteLength) \ |
| 2213 F(ArrayBufferViewGetByteOffset) \ |
| 2214 F(TypedArrayGetLength) \ |
| 2215 /* ArrayBuffer */ \ |
| 2216 F(ArrayBufferGetByteLength) \ |
| 2217 /* Maths */ \ |
| 2218 F(ConstructDouble) \ |
| 2219 F(DoubleHi) \ |
| 2220 F(DoubleLo) \ |
| 2221 F(MathFloor) \ |
| 2222 F(MathSqrtRT) \ |
| 2223 F(MathLogRT) \ |
| 2224 /* ES6 Collections */ \ |
| 2225 F(MapClear) \ |
| 2226 F(MapDelete) \ |
| 2227 F(MapGet) \ |
| 2228 F(MapGetSize) \ |
| 2229 F(MapHas) \ |
| 2230 F(MapInitialize) \ |
| 2231 F(MapSet) \ |
| 2232 F(SetAdd) \ |
| 2233 F(SetClear) \ |
| 2234 F(SetDelete) \ |
| 2235 F(SetGetSize) \ |
| 2236 F(SetHas) \ |
| 2237 F(SetInitialize) \ |
| 2238 /* Arrays */ \ |
| 2239 F(HasFastPackedElements) \ |
| 2240 F(GetPrototype) |
2176 | 2241 |
2177 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) | 2242 #define GENERATOR_DECLARATION(Name) void Generate##Name(CallRuntime* call); |
2178 INLINE_OPTIMIZED_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) | 2243 FOR_EACH_HYDROGEN_INTRINSIC(GENERATOR_DECLARATION) |
2179 #undef INLINE_FUNCTION_GENERATOR_DECLARATION | 2244 #undef GENERATOR_DECLARATION |
2180 | 2245 |
2181 void VisitDelete(UnaryOperation* expr); | 2246 void VisitDelete(UnaryOperation* expr); |
2182 void VisitVoid(UnaryOperation* expr); | 2247 void VisitVoid(UnaryOperation* expr); |
2183 void VisitTypeof(UnaryOperation* expr); | 2248 void VisitTypeof(UnaryOperation* expr); |
2184 void VisitNot(UnaryOperation* expr); | 2249 void VisitNot(UnaryOperation* expr); |
2185 | 2250 |
2186 void VisitComma(BinaryOperation* expr); | 2251 void VisitComma(BinaryOperation* expr); |
2187 void VisitLogicalExpression(BinaryOperation* expr); | 2252 void VisitLogicalExpression(BinaryOperation* expr); |
2188 void VisitArithmeticExpression(BinaryOperation* expr); | 2253 void VisitArithmeticExpression(BinaryOperation* expr); |
2189 | 2254 |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2966 } | 3031 } |
2967 | 3032 |
2968 private: | 3033 private: |
2969 HGraphBuilder* builder_; | 3034 HGraphBuilder* builder_; |
2970 }; | 3035 }; |
2971 | 3036 |
2972 | 3037 |
2973 } } // namespace v8::internal | 3038 } } // namespace v8::internal |
2974 | 3039 |
2975 #endif // V8_HYDROGEN_H_ | 3040 #endif // V8_HYDROGEN_H_ |
OLD | NEW |