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

Side by Side Diff: src/arm64/lithium-arm64.h

Issue 308313002: ARM64: Avoid regeneration of constants. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | src/arm64/lithium-arm64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64_LITHIUM_ARM64_H_ 5 #ifndef V8_ARM64_LITHIUM_ARM64_H_
6 #define V8_ARM64_LITHIUM_ARM64_H_ 6 #define V8_ARM64_LITHIUM_ARM64_H_
7 7
8 #include "hydrogen.h" 8 #include "hydrogen.h"
9 #include "lithium-allocator.h" 9 #include "lithium-allocator.h"
10 #include "lithium.h" 10 #include "lithium.h"
(...skipping 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 } 3005 }
3006 3006
3007 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver") 3007 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
3008 DECLARE_HYDROGEN_ACCESSOR(WrapReceiver) 3008 DECLARE_HYDROGEN_ACCESSOR(WrapReceiver)
3009 3009
3010 LOperand* receiver() { return inputs_[0]; } 3010 LOperand* receiver() { return inputs_[0]; }
3011 LOperand* function() { return inputs_[1]; } 3011 LOperand* function() { return inputs_[1]; }
3012 }; 3012 };
3013 3013
3014 3014
3015 class ConstantCache {
3016 public:
3017 ConstantCache() {}
3018
3019 class ConstantCacheLevel {
3020 public:
3021 void Cache(HConstant* constant) { cached_constants_.insert(constant); }
3022 bool IsCached(HConstant* constant) {
3023 return cached_constants_.find(constant) != cached_constants_.end();
3024 }
3025
3026 private:
3027 std::set<HConstant*> cached_constants_;
3028 };
3029
3030 void Clear() { cache_levels_.clear(); }
3031
3032 void Cache(HConstant* constant, HBasicBlock* block) {
3033 cache_levels_[block].Cache(constant);
3034 }
3035
3036 bool IsCached(HConstant* constant, HBasicBlock* block) {
3037 HBasicBlock* base_block = block;
3038 std::map<HBasicBlock*, ConstantCacheLevel>::iterator it;
3039 while (block != NULL) {
3040 it = cache_levels_.find(block);
3041 if (it != cache_levels_.end() && it->second.IsCached(constant)) {
3042 if (base_block != block) {
3043 // Avoid traversing the dominator blocks multiple times for the same
3044 // constant.
3045 cache_levels_[block].Cache(constant);
3046 }
3047 return true;
3048 }
3049 block = block->dominator();
3050 }
3051 return false;
3052 }
3053
3054 private:
3055 std::map<HBasicBlock*, ConstantCacheLevel> cache_levels_;
3056 };
3057
3058
3015 class LChunkBuilder; 3059 class LChunkBuilder;
3016 class LPlatformChunk V8_FINAL : public LChunk { 3060 class LPlatformChunk V8_FINAL : public LChunk {
3017 public: 3061 public:
3018 LPlatformChunk(CompilationInfo* info, HGraph* graph) 3062 LPlatformChunk(CompilationInfo* info, HGraph* graph)
3019 : LChunk(info, graph) { } 3063 : LChunk(info, graph) { }
3020 3064
3021 int GetNextSpillIndex(); 3065 int GetNextSpillIndex();
3022 LOperand* GetNextSpillSlot(RegisterKind kind); 3066 LOperand* GetNextSpillSlot(RegisterKind kind);
3023 }; 3067 };
3024 3068
(...skipping 23 matching lines...) Expand all
3048 LInstruction* DoDivI(HBinaryOperation* instr); 3092 LInstruction* DoDivI(HBinaryOperation* instr);
3049 LInstruction* DoModByPowerOf2I(HMod* instr); 3093 LInstruction* DoModByPowerOf2I(HMod* instr);
3050 LInstruction* DoModByConstI(HMod* instr); 3094 LInstruction* DoModByConstI(HMod* instr);
3051 LInstruction* DoModI(HMod* instr); 3095 LInstruction* DoModI(HMod* instr);
3052 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr); 3096 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
3053 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr); 3097 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
3054 LInstruction* DoFlooringDivI(HMathFloorOfDiv* instr); 3098 LInstruction* DoFlooringDivI(HMathFloorOfDiv* instr);
3055 3099
3056 static bool HasMagicNumberForDivision(int32_t divisor); 3100 static bool HasMagicNumberForDivision(int32_t divisor);
3057 3101
3102 bool IsCachedConstant(HConstant* constant, HBasicBlock* block) {
3103 return constant_cache_.IsCached(constant, block);
3104 }
3105 void CacheConstant(HConstant* constant, HBasicBlock* block) {
3106 constant_cache_.Cache(constant, block);
3107 }
3108
3058 private: 3109 private:
3059 enum Status { 3110 enum Status {
3060 UNUSED, 3111 UNUSED,
3061 BUILDING, 3112 BUILDING,
3062 DONE, 3113 DONE,
3063 ABORTED 3114 ABORTED
3064 }; 3115 };
3065 3116
3066 HGraph* graph() const { return graph_; } 3117 HGraph* graph() const { return graph_; }
3067 Isolate* isolate() const { return info_->isolate(); } 3118 Isolate* isolate() const { return info_->isolate(); }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
3198 LInstruction* DoArithmeticT(Token::Value op, 3249 LInstruction* DoArithmeticT(Token::Value op,
3199 HBinaryOperation* instr); 3250 HBinaryOperation* instr);
3200 3251
3201 LPlatformChunk* chunk_; 3252 LPlatformChunk* chunk_;
3202 CompilationInfo* info_; 3253 CompilationInfo* info_;
3203 HGraph* const graph_; 3254 HGraph* const graph_;
3204 Status status_; 3255 Status status_;
3205 HInstruction* current_instruction_; 3256 HInstruction* current_instruction_;
3206 HBasicBlock* current_block_; 3257 HBasicBlock* current_block_;
3207 LAllocator* allocator_; 3258 LAllocator* allocator_;
3259 ConstantCache constant_cache_;
3208 3260
3209 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 3261 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
3210 }; 3262 };
3211 3263
3212 #undef DECLARE_HYDROGEN_ACCESSOR 3264 #undef DECLARE_HYDROGEN_ACCESSOR
3213 #undef DECLARE_CONCRETE_INSTRUCTION 3265 #undef DECLARE_CONCRETE_INSTRUCTION
3214 3266
3215 } } // namespace v8::internal 3267 } } // namespace v8::internal
3216 3268
3217 #endif // V8_ARM64_LITHIUM_ARM64_H_ 3269 #endif // V8_ARM64_LITHIUM_ARM64_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm64/lithium-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698