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

Side by Side Diff: src/hydrogen.h

Issue 282093009: Emit mementos in crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE. Created 6 years, 6 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 | « src/flag-definitions.h ('k') | src/hydrogen.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 // 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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 HBasicBlock* true_branch() const { return true_branch_; } 998 HBasicBlock* true_branch() const { return true_branch_; }
999 HBasicBlock* false_branch() const { return false_branch_; } 999 HBasicBlock* false_branch() const { return false_branch_; }
1000 1000
1001 private: 1001 private:
1002 bool continuation_captured_; 1002 bool continuation_captured_;
1003 HBasicBlock* true_branch_; 1003 HBasicBlock* true_branch_;
1004 HBasicBlock* false_branch_; 1004 HBasicBlock* false_branch_;
1005 }; 1005 };
1006 1006
1007 1007
1008 class HAllocationMode V8_FINAL BASE_EMBEDDED {
1009 public:
1010 explicit HAllocationMode(Handle<AllocationSite> feedback_site)
1011 : current_site_(NULL), feedback_site_(feedback_site),
1012 pretenure_flag_(NOT_TENURED) {}
1013 explicit HAllocationMode(HValue* current_site)
1014 : current_site_(current_site), pretenure_flag_(NOT_TENURED) {}
1015 explicit HAllocationMode(PretenureFlag pretenure_flag)
1016 : current_site_(NULL), pretenure_flag_(pretenure_flag) {}
1017 HAllocationMode()
1018 : current_site_(NULL), pretenure_flag_(NOT_TENURED) {}
1019
1020 HValue* current_site() const { return current_site_; }
1021 Handle<AllocationSite> feedback_site() const { return feedback_site_; }
1022
1023 bool CreateAllocationMementos() const V8_WARN_UNUSED_RESULT {
1024 return current_site() != NULL;
1025 }
1026
1027 PretenureFlag GetPretenureMode() const V8_WARN_UNUSED_RESULT {
1028 if (!feedback_site().is_null()) return feedback_site()->GetPretenureMode();
1029 return pretenure_flag_;
1030 }
1031
1032 private:
1033 HValue* current_site_;
1034 Handle<AllocationSite> feedback_site_;
1035 PretenureFlag pretenure_flag_;
1036 };
1037
1038
1039 class HGraphBuilder { 1008 class HGraphBuilder {
1040 public: 1009 public:
1041 explicit HGraphBuilder(CompilationInfo* info) 1010 explicit HGraphBuilder(CompilationInfo* info)
1042 : info_(info), 1011 : info_(info),
1043 graph_(NULL), 1012 graph_(NULL),
1044 current_block_(NULL), 1013 current_block_(NULL),
1045 position_(HSourcePosition::Unknown()), 1014 position_(HSourcePosition::Unknown()),
1046 start_position_(0) {} 1015 start_position_(0) {}
1047 virtual ~HGraphBuilder() {} 1016 virtual ~HGraphBuilder() {}
1048 1017
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 FunctionState* function_state() const { return function_state_; } 2036 FunctionState* function_state() const { return function_state_; }
2068 2037
2069 void VisitDeclarations(ZoneList<Declaration*>* declarations); 2038 void VisitDeclarations(ZoneList<Declaration*>* declarations);
2070 2039
2071 void* operator new(size_t size, Zone* zone) { 2040 void* operator new(size_t size, Zone* zone) {
2072 return zone->New(static_cast<int>(size)); 2041 return zone->New(static_cast<int>(size));
2073 } 2042 }
2074 void operator delete(void* pointer, Zone* zone) { } 2043 void operator delete(void* pointer, Zone* zone) { }
2075 void operator delete(void* pointer) { } 2044 void operator delete(void* pointer) { }
2076 2045
2046 void InitializeAllocationModeForCallNew(CallNew* expr, HAllocationMode* mode);
2047
2077 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 2048 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
2078 2049
2079 protected: 2050 protected:
2080 // Type of a member function that generates inline code for a native function. 2051 // Type of a member function that generates inline code for a native function.
2081 typedef void (HOptimizedGraphBuilder::*InlineFunctionGenerator) 2052 typedef void (HOptimizedGraphBuilder::*InlineFunctionGenerator)
2082 (CallRuntime* call); 2053 (CallRuntime* call);
2083 2054
2084 // Forward declarations for inner scope classes. 2055 // Forward declarations for inner scope classes.
2085 class SubgraphScope; 2056 class SubgraphScope;
2086 2057
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 LookupResult* lookup, 2225 LookupResult* lookup,
2255 PropertyAccessType access_type); 2226 PropertyAccessType access_type);
2256 2227
2257 void EnsureArgumentsArePushedForAccess(); 2228 void EnsureArgumentsArePushedForAccess();
2258 bool TryArgumentsAccess(Property* expr); 2229 bool TryArgumentsAccess(Property* expr);
2259 2230
2260 // Try to optimize fun.apply(receiver, arguments) pattern. 2231 // Try to optimize fun.apply(receiver, arguments) pattern.
2261 bool TryCallApply(Call* expr); 2232 bool TryCallApply(Call* expr);
2262 2233
2263 bool TryHandleArrayCall(Call* expr, HValue* function); 2234 bool TryHandleArrayCall(Call* expr, HValue* function);
2264 bool TryHandleArrayCallNew(CallNew* expr, HValue* function); 2235 bool TryHandleArrayCallNew(CallNew* expr, HValue* function,
2236 HAllocationMode mode);
2265 void BuildArrayCall(Expression* expr, int arguments_count, HValue* function, 2237 void BuildArrayCall(Expression* expr, int arguments_count, HValue* function,
2266 Handle<AllocationSite> cell); 2238 Handle<AllocationSite> cell, HAllocationMode mode);
2267 2239
2268 enum ArrayIndexOfMode { kFirstIndexOf, kLastIndexOf }; 2240 enum ArrayIndexOfMode { kFirstIndexOf, kLastIndexOf };
2269 HValue* BuildArrayIndexOf(HValue* receiver, 2241 HValue* BuildArrayIndexOf(HValue* receiver,
2270 HValue* search_element, 2242 HValue* search_element,
2271 ElementsKind kind, 2243 ElementsKind kind,
2272 ArrayIndexOfMode mode); 2244 ArrayIndexOfMode mode);
2273 2245
2274 HValue* ImplicitReceiverFor(HValue* function, 2246 HValue* ImplicitReceiverFor(HValue* function,
2275 Handle<JSFunction> target); 2247 Handle<JSFunction> target);
2276 2248
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 ExternalArrayType array_type, size_t element_size, 2325 ExternalArrayType array_type, size_t element_size,
2354 ElementsKind fixed_elements_kind, 2326 ElementsKind fixed_elements_kind,
2355 HValue* byte_length, HValue* length); 2327 HValue* byte_length, HValue* length);
2356 2328
2357 Handle<JSFunction> array_function() { 2329 Handle<JSFunction> array_function() {
2358 return handle(isolate()->native_context()->array_function()); 2330 return handle(isolate()->native_context()->array_function());
2359 } 2331 }
2360 2332
2361 bool IsCallArrayInlineable(int argument_count, Handle<AllocationSite> site); 2333 bool IsCallArrayInlineable(int argument_count, Handle<AllocationSite> site);
2362 void BuildInlinedCallArray(Expression* expression, int argument_count, 2334 void BuildInlinedCallArray(Expression* expression, int argument_count,
2363 Handle<AllocationSite> site); 2335 HAllocationMode mode, Handle<AllocationSite> site);
2364 2336
2365 class PropertyAccessInfo { 2337 class PropertyAccessInfo {
2366 public: 2338 public:
2367 PropertyAccessInfo(HOptimizedGraphBuilder* builder, 2339 PropertyAccessInfo(HOptimizedGraphBuilder* builder,
2368 PropertyAccessType access_type, 2340 PropertyAccessType access_type,
2369 Type* type, 2341 Type* type,
2370 Handle<String> name) 2342 Handle<String> name)
2371 : lookup_(builder->isolate()), 2343 : lookup_(builder->isolate()),
2372 builder_(builder), 2344 builder_(builder),
2373 access_type_(access_type), 2345 access_type_(access_type),
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
2830 } 2802 }
2831 2803
2832 private: 2804 private:
2833 HGraphBuilder* builder_; 2805 HGraphBuilder* builder_;
2834 }; 2806 };
2835 2807
2836 2808
2837 } } // namespace v8::internal 2809 } } // namespace v8::internal
2838 2810
2839 #endif // V8_HYDROGEN_H_ 2811 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698