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

Side by Side Diff: src/hydrogen.h

Issue 155723005: A64: Synchronize with r19001. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/heap-snapshot-generator.cc ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void DetachLoopInformation(); 105 void DetachLoopInformation();
106 bool IsLoopHeader() const { return loop_information() != NULL; } 106 bool IsLoopHeader() const { return loop_information() != NULL; }
107 bool IsStartBlock() const { return block_id() == 0; } 107 bool IsStartBlock() const { return block_id() == 0; }
108 void PostProcessLoopHeader(IterationStatement* stmt); 108 void PostProcessLoopHeader(IterationStatement* stmt);
109 109
110 bool IsFinished() const { return end_ != NULL; } 110 bool IsFinished() const { return end_ != NULL; }
111 void AddPhi(HPhi* phi); 111 void AddPhi(HPhi* phi);
112 void RemovePhi(HPhi* phi); 112 void RemovePhi(HPhi* phi);
113 void AddInstruction(HInstruction* instr, int position); 113 void AddInstruction(HInstruction* instr, int position);
114 bool Dominates(HBasicBlock* other) const; 114 bool Dominates(HBasicBlock* other) const;
115 bool EqualToOrDominates(HBasicBlock* other) const;
115 int LoopNestingDepth() const; 116 int LoopNestingDepth() const;
116 117
117 void SetInitialEnvironment(HEnvironment* env); 118 void SetInitialEnvironment(HEnvironment* env);
118 void ClearEnvironment() { 119 void ClearEnvironment() {
119 ASSERT(IsFinished()); 120 ASSERT(IsFinished());
120 ASSERT(end()->SuccessorCount() == 0); 121 ASSERT(end()->SuccessorCount() == 0);
121 last_environment_ = NULL; 122 last_environment_ = NULL;
122 } 123 }
123 bool HasEnvironment() const { return last_environment_ != NULL; } 124 bool HasEnvironment() const { return last_environment_ != NULL; }
124 void UpdateEnvironment(HEnvironment* env); 125 void UpdateEnvironment(HEnvironment* env);
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 Handle<JSFunction> target); 2204 Handle<JSFunction> target);
2204 2205
2205 int InliningAstSize(Handle<JSFunction> target); 2206 int InliningAstSize(Handle<JSFunction> target);
2206 bool TryInline(Handle<JSFunction> target, 2207 bool TryInline(Handle<JSFunction> target,
2207 int arguments_count, 2208 int arguments_count,
2208 HValue* implicit_return_value, 2209 HValue* implicit_return_value,
2209 BailoutId ast_id, 2210 BailoutId ast_id,
2210 BailoutId return_id, 2211 BailoutId return_id,
2211 InliningKind inlining_kind); 2212 InliningKind inlining_kind);
2212 2213
2213 bool TryInlineCall(Call* expr, bool drop_extra = false); 2214 bool TryInlineCall(Call* expr);
2214 bool TryInlineConstruct(CallNew* expr, HValue* implicit_return_value); 2215 bool TryInlineConstruct(CallNew* expr, HValue* implicit_return_value);
2215 bool TryInlineGetter(Handle<JSFunction> getter, 2216 bool TryInlineGetter(Handle<JSFunction> getter,
2216 BailoutId ast_id, 2217 BailoutId ast_id,
2217 BailoutId return_id); 2218 BailoutId return_id);
2218 bool TryInlineSetter(Handle<JSFunction> setter, 2219 bool TryInlineSetter(Handle<JSFunction> setter,
2219 BailoutId id, 2220 BailoutId id,
2220 BailoutId assignment_id, 2221 BailoutId assignment_id,
2221 HValue* implicit_return_value); 2222 HValue* implicit_return_value);
2222 bool TryInlineApply(Handle<JSFunction> function, 2223 bool TryInlineApply(Handle<JSFunction> function,
2223 Call* expr, 2224 Call* expr,
2224 int arguments_count); 2225 int arguments_count);
2225 bool TryInlineBuiltinMethodCall(Call* expr, 2226 bool TryInlineBuiltinMethodCall(Call* expr,
2226 HValue* receiver, 2227 HValue* receiver,
2227 Handle<Map> receiver_map, 2228 Handle<Map> receiver_map);
2228 CheckType check_type); 2229 bool TryInlineBuiltinFunctionCall(Call* expr);
2229 bool TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra); 2230 bool TryInlineApiMethodCall(Call* expr,
2231 HValue* receiver,
2232 Handle<Map> receiver_map);
2233 bool TryInlineApiFunctionCall(Call* expr, HValue* receiver);
2234 bool TryInlineApiCall(Call* expr,
2235 HValue* receiver,
2236 Handle<Map> receiver_map,
2237 bool is_function_call);
2230 2238
2231 // If --trace-inlining, print a line of the inlining trace. Inlining 2239 // If --trace-inlining, print a line of the inlining trace. Inlining
2232 // succeeded if the reason string is NULL and failed if there is a 2240 // succeeded if the reason string is NULL and failed if there is a
2233 // non-NULL reason string. 2241 // non-NULL reason string.
2234 void TraceInline(Handle<JSFunction> target, 2242 void TraceInline(Handle<JSFunction> target,
2235 Handle<JSFunction> caller, 2243 Handle<JSFunction> caller,
2236 const char* failure_reason); 2244 const char* failure_reason);
2237 2245
2238 void HandleGlobalVariableAssignment(Variable* var, 2246 void HandleGlobalVariableAssignment(Variable* var,
2239 HValue* value, 2247 HValue* value,
2240 BailoutId ast_id); 2248 BailoutId ast_id);
2241 2249
2242 void HandlePropertyAssignment(Assignment* expr); 2250 void HandlePropertyAssignment(Assignment* expr);
2243 void HandleCompoundAssignment(Assignment* expr); 2251 void HandleCompoundAssignment(Assignment* expr);
2244 void HandlePolymorphicLoadNamedField(BailoutId ast_id, 2252 void HandlePolymorphicLoadNamedField(BailoutId ast_id,
2245 BailoutId return_id, 2253 BailoutId return_id,
2246 HValue* object, 2254 HValue* object,
2247 SmallMapList* types, 2255 SmallMapList* types,
2248 Handle<String> name); 2256 Handle<String> name);
2249 2257
2250 void VisitTypedArrayInitialize(CallRuntime* expr); 2258 void VisitTypedArrayInitialize(CallRuntime* expr);
2251 2259
2252 bool IsCallNewArrayInlineable(CallNew* expr); 2260 bool IsCallNewArrayInlineable(CallNew* expr);
2253 void BuildInlinedCallNewArray(CallNew* expr); 2261 void BuildInlinedCallNewArray(CallNew* expr);
2254 2262
2255 void VisitDataViewInitialize(CallRuntime* expr); 2263 void VisitDataViewInitialize(CallRuntime* expr);
2256 2264
2257 class PropertyAccessInfo { 2265 class PropertyAccessInfo {
2258 public: 2266 public:
2259 PropertyAccessInfo(Isolate* isolate, Handle<Map> map, Handle<String> name) 2267 PropertyAccessInfo(HOptimizedGraphBuilder* builder,
2260 : lookup_(isolate), 2268 Handle<HeapType> type,
2261 map_(map), 2269 Handle<String> name)
2270 : lookup_(builder->isolate()),
2271 builder_(builder),
2272 type_(type),
2262 name_(name), 2273 name_(name),
2263 access_(HObjectAccess::ForMap()) { } 2274 access_(HObjectAccess::ForMap()) { }
2264 2275
2265 // Checkes whether this PropertyAccessInfo can be handled as a monomorphic 2276 // Checkes whether this PropertyAccessInfo can be handled as a monomorphic
2266 // load named. It additionally fills in the fields necessary to generate the 2277 // load named. It additionally fills in the fields necessary to generate the
2267 // lookup code. 2278 // lookup code.
2268 bool CanLoadMonomorphic(); 2279 bool CanLoadMonomorphic();
2269 2280
2270 // Checks whether all types behave uniform when loading name. If all maps 2281 // Checks whether all types behave uniform when loading name. If all maps
2271 // behave the same, a single monomorphic load instruction can be emitted, 2282 // behave the same, a single monomorphic load instruction can be emitted,
2272 // guarded by a single map-checks instruction that whether the receiver is 2283 // guarded by a single map-checks instruction that whether the receiver is
2273 // an instance of any of the types. 2284 // an instance of any of the types.
2274 // This method skips the first type in types, assuming that this 2285 // This method skips the first type in types, assuming that this
2275 // PropertyAccessInfo is built for types->first(). 2286 // PropertyAccessInfo is built for types->first().
2276 bool CanLoadAsMonomorphic(SmallMapList* types); 2287 bool CanLoadAsMonomorphic(SmallMapList* types);
2277 2288
2289 Handle<Map> map() {
2290 if (type_->Is(HeapType::Number())) {
2291 Context* context = current_info()->closure()->context();
2292 context = context->native_context();
2293 return handle(context->number_function()->initial_map());
2294 } else if (type_->Is(HeapType::String())) {
2295 Context* context = current_info()->closure()->context();
2296 context = context->native_context();
2297 return handle(context->string_function()->initial_map());
2298 } else {
2299 return type_->AsClass();
2300 }
2301 }
2302 Handle<HeapType> type() const { return type_; }
2303 Handle<String> name() const { return name_; }
2304
2278 bool IsJSObjectFieldAccessor() { 2305 bool IsJSObjectFieldAccessor() {
2279 int offset; // unused 2306 int offset; // unused
2280 return Accessors::IsJSObjectFieldAccessor(map_, name_, &offset); 2307 return Accessors::IsJSObjectFieldAccessor(type_, name_, &offset);
2281 } 2308 }
2282 2309
2283 bool GetJSObjectFieldAccess(HObjectAccess* access) { 2310 bool GetJSObjectFieldAccess(HObjectAccess* access) {
2284 if (IsStringLength()) { 2311 if (IsArrayLength()) {
2285 *access = HObjectAccess::ForStringLength(); 2312 *access = HObjectAccess::ForArrayLength(map()->elements_kind());
2286 return true; 2313 return true;
2287 } else if (IsArrayLength()) { 2314 }
2288 *access = HObjectAccess::ForArrayLength(map_->elements_kind()); 2315 int offset;
2316 if (Accessors::IsJSObjectFieldAccessor(type_, name_, &offset)) {
2317 if (type_->Is(HeapType::String())) {
2318 ASSERT(name_->Equals(isolate()->heap()->length_string()));
2319 *access = HObjectAccess::ForStringLength();
2320 } else {
2321 *access = HObjectAccess::ForJSObjectOffset(offset);
2322 }
2289 return true; 2323 return true;
2290 } else {
2291 int offset;
2292 if (Accessors::IsJSObjectFieldAccessor(map_, name_, &offset)) {
2293 *access = HObjectAccess::ForJSObjectOffset(offset);
2294 return true;
2295 }
2296 return false;
2297 } 2324 }
2325 return false;
2298 } 2326 }
2299 2327
2300 bool has_holder() { return !holder_.is_null(); } 2328 bool has_holder() { return !holder_.is_null(); }
2301 2329
2302 LookupResult* lookup() { return &lookup_; } 2330 LookupResult* lookup() { return &lookup_; }
2303 Handle<Map> map() { return map_; }
2304 Handle<JSObject> holder() { return holder_; } 2331 Handle<JSObject> holder() { return holder_; }
2305 Handle<JSFunction> accessor() { return accessor_; } 2332 Handle<JSFunction> accessor() { return accessor_; }
2306 Handle<Object> constant() { return constant_; } 2333 Handle<Object> constant() { return constant_; }
2307 HObjectAccess access() { return access_; } 2334 HObjectAccess access() { return access_; }
2308 2335
2309 private: 2336 private:
2310 Isolate* isolate() { return lookup_.isolate(); } 2337 Isolate* isolate() { return lookup_.isolate(); }
2338 CompilationInfo* current_info() { return builder_->current_info(); }
2311 2339
2312 bool IsStringLength() { 2340 bool IsArrayLength() {
2313 return map_->instance_type() < FIRST_NONSTRING_TYPE && 2341 return map()->instance_type() == JS_ARRAY_TYPE &&
2314 name_->Equals(isolate()->heap()->length_string()); 2342 name_->Equals(isolate()->heap()->length_string());
2315 } 2343 }
2316 2344
2317 bool IsArrayLength() {
2318 return map_->instance_type() == JS_ARRAY_TYPE &&
2319 name_->Equals(isolate()->heap()->length_string());
2320 }
2321
2322 bool LoadResult(Handle<Map> map); 2345 bool LoadResult(Handle<Map> map);
2323 bool LookupDescriptor(); 2346 bool LookupDescriptor();
2324 bool LookupInPrototypes(); 2347 bool LookupInPrototypes();
2325 bool IsCompatibleForLoad(PropertyAccessInfo* other); 2348 bool IsCompatibleForLoad(PropertyAccessInfo* other);
2326 2349
2327 void GeneralizeRepresentation(Representation r) { 2350 void GeneralizeRepresentation(Representation r) {
2328 access_ = access_.WithRepresentation( 2351 access_ = access_.WithRepresentation(
2329 access_.representation().generalize(r)); 2352 access_.representation().generalize(r));
2330 } 2353 }
2331 2354
2332 LookupResult lookup_; 2355 LookupResult lookup_;
2333 Handle<Map> map_; 2356 HOptimizedGraphBuilder* builder_;
2357 Handle<HeapType> type_;
2334 Handle<String> name_; 2358 Handle<String> name_;
2335 Handle<JSObject> holder_; 2359 Handle<JSObject> holder_;
2336 Handle<JSFunction> accessor_; 2360 Handle<JSFunction> accessor_;
2337 Handle<Object> constant_; 2361 Handle<Object> constant_;
2338 HObjectAccess access_; 2362 HObjectAccess access_;
2339 }; 2363 };
2340 2364
2341 HInstruction* BuildLoadMonomorphic(PropertyAccessInfo* info, 2365 HInstruction* BuildLoadMonomorphic(PropertyAccessInfo* info,
2342 HValue* object, 2366 HValue* object,
2343 HInstruction* checked_object, 2367 HValue* checked_object,
2344 BailoutId ast_id, 2368 BailoutId ast_id,
2345 BailoutId return_id, 2369 BailoutId return_id,
2346 bool can_inline_accessor = true); 2370 bool can_inline_accessor = true);
2347 2371
2348 void HandlePolymorphicStoreNamedField(BailoutId assignment_id, 2372 void HandlePolymorphicStoreNamedField(BailoutId assignment_id,
2349 HValue* object, 2373 HValue* object,
2350 HValue* value, 2374 HValue* value,
2351 SmallMapList* types, 2375 SmallMapList* types,
2352 Handle<String> name); 2376 Handle<String> name);
2353 bool TryStorePolymorphicAsMonomorphic(BailoutId assignment_id, 2377 bool TryStorePolymorphicAsMonomorphic(BailoutId assignment_id,
2354 HValue* object, 2378 HValue* object,
2355 HValue* value, 2379 HValue* value,
2356 SmallMapList* types, 2380 SmallMapList* types,
2357 Handle<String> name); 2381 Handle<String> name);
2358 void HandlePolymorphicCallNamed(Call* expr, 2382 void HandlePolymorphicCallNamed(Call* expr,
2359 HValue* receiver, 2383 HValue* receiver,
2360 SmallMapList* types, 2384 SmallMapList* types,
2361 Handle<String> name); 2385 Handle<String> name);
2362 bool TryCallPolymorphicAsMonomorphic(Call* expr,
2363 HValue* receiver,
2364 SmallMapList* types,
2365 Handle<String> name);
2366 void HandleLiteralCompareTypeof(CompareOperation* expr, 2386 void HandleLiteralCompareTypeof(CompareOperation* expr,
2367 Expression* sub_expr, 2387 Expression* sub_expr,
2368 Handle<String> check); 2388 Handle<String> check);
2369 void HandleLiteralCompareNil(CompareOperation* expr, 2389 void HandleLiteralCompareNil(CompareOperation* expr,
2370 Expression* sub_expr, 2390 Expression* sub_expr,
2371 NilValue nil); 2391 NilValue nil);
2372 HControlInstruction* BuildCompareInstruction(Token::Value op, 2392 HControlInstruction* BuildCompareInstruction(Token::Value op,
2373 HValue* left, 2393 HValue* left,
2374 HValue* right, 2394 HValue* right,
2375 Type* left_type, 2395 Type* left_type,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 HValue* object_elements); 2510 HValue* object_elements);
2491 2511
2492 void BuildEmitFixedArray(Handle<FixedArrayBase> elements, 2512 void BuildEmitFixedArray(Handle<FixedArrayBase> elements,
2493 ElementsKind kind, 2513 ElementsKind kind,
2494 HValue* object_elements, 2514 HValue* object_elements,
2495 AllocationSiteUsageContext* site_context); 2515 AllocationSiteUsageContext* site_context);
2496 2516
2497 void AddCheckPrototypeMaps(Handle<JSObject> holder, 2517 void AddCheckPrototypeMaps(Handle<JSObject> holder,
2498 Handle<Map> receiver_map); 2518 Handle<Map> receiver_map);
2499 2519
2500 void AddCheckConstantFunction(Handle<JSObject> holder,
2501 HValue* receiver,
2502 Handle<Map> receiver_map);
2503
2504 HInstruction* NewPlainFunctionCall(HValue* fun, 2520 HInstruction* NewPlainFunctionCall(HValue* fun,
2505 int argument_count, 2521 int argument_count,
2506 bool pass_argument_count); 2522 bool pass_argument_count);
2507 2523
2508 HInstruction* NewArgumentAdaptorCall(HValue* fun, HValue* context, 2524 HInstruction* NewArgumentAdaptorCall(HValue* fun, HValue* context,
2509 int argument_count, 2525 int argument_count,
2510 HValue* expected_param_count); 2526 HValue* expected_param_count);
2511 2527
2512 HInstruction* BuildCallConstantFunction(Handle<JSFunction> target, 2528 HInstruction* BuildCallConstantFunction(Handle<JSFunction> target,
2513 int argument_count); 2529 int argument_count);
2514 2530
2515 HInstruction* NewCallKeyed(HValue* key, int argument_count);
2516
2517 HInstruction* NewCallNamed(Handle<String> name, int argument_count);
2518
2519 // The translation state of the currently-being-translated function. 2531 // The translation state of the currently-being-translated function.
2520 FunctionState* function_state_; 2532 FunctionState* function_state_;
2521 2533
2522 // The base of the function state stack. 2534 // The base of the function state stack.
2523 FunctionState initial_function_state_; 2535 FunctionState initial_function_state_;
2524 2536
2525 // Expression context of the currently visited subexpression. NULL when 2537 // Expression context of the currently visited subexpression. NULL when
2526 // visiting statements. 2538 // visiting statements.
2527 AstContext* ast_context_; 2539 AstContext* ast_context_;
2528 2540
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2700 } 2712 }
2701 2713
2702 private: 2714 private:
2703 HGraphBuilder* builder_; 2715 HGraphBuilder* builder_;
2704 }; 2716 };
2705 2717
2706 2718
2707 } } // namespace v8::internal 2719 } } // namespace v8::internal
2708 2720
2709 #endif // V8_HYDROGEN_H_ 2721 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698