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

Side by Side Diff: src/assembler.h

Issue 11348195: PredictableCodeSizeScope checks the expected size now. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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/arm/lithium-codegen-arm.cc ('k') | src/assembler.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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 int jit_cookie_; 91 int jit_cookie_;
92 bool emit_debug_code_; 92 bool emit_debug_code_;
93 bool predictable_code_size_; 93 bool predictable_code_size_;
94 }; 94 };
95 95
96 96
97 // Avoids using instructions that vary in size in unpredictable ways between the 97 // Avoids using instructions that vary in size in unpredictable ways between the
98 // snapshot and the running VM. 98 // snapshot and the running VM.
99 class PredictableCodeSizeScope { 99 class PredictableCodeSizeScope {
100 public: 100 public:
101 explicit PredictableCodeSizeScope(AssemblerBase* assembler) 101 PredictableCodeSizeScope(AssemblerBase* assembler, int expected_size);
102 : assembler_(assembler) { 102 ~PredictableCodeSizeScope();
103 old_value_ = assembler_->predictable_code_size();
104 assembler_->set_predictable_code_size(true);
105 }
106
107 ~PredictableCodeSizeScope() {
108 assembler_->set_predictable_code_size(old_value_);
109 }
110 103
111 private: 104 private:
112 AssemblerBase* assembler_; 105 AssemblerBase* assembler_;
106 int expected_size_;
107 int start_offset_;
113 bool old_value_; 108 bool old_value_;
114 }; 109 };
115 110
116 111
117 // ----------------------------------------------------------------------------- 112 // -----------------------------------------------------------------------------
118 // Labels represent pc locations; they are typically jump or call targets. 113 // Labels represent pc locations; they are typically jump or call targets.
119 // After declaration, a label can be freely used to denote known or (yet) 114 // After declaration, a label can be freely used to denote known or (yet)
120 // unknown pc location. Assembler::bind() is used to bind a label to the 115 // unknown pc location. Assembler::bind() is used to bind a label to the
121 // current pc. A label can be bound only once. 116 // current pc. A label can be bound only once.
122 117
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 public: 947 public:
953 NullCallWrapper() { } 948 NullCallWrapper() { }
954 virtual ~NullCallWrapper() { } 949 virtual ~NullCallWrapper() { }
955 virtual void BeforeCall(int call_size) const { } 950 virtual void BeforeCall(int call_size) const { }
956 virtual void AfterCall() const { } 951 virtual void AfterCall() const { }
957 }; 952 };
958 953
959 } } // namespace v8::internal 954 } } // namespace v8::internal
960 955
961 #endif // V8_ASSEMBLER_H_ 956 #endif // V8_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698