OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 Object* StubCache::ComputeLoadField(String* name, | 96 Object* StubCache::ComputeLoadField(String* name, |
97 JSObject* receiver, | 97 JSObject* receiver, |
98 JSObject* holder, | 98 JSObject* holder, |
99 int field_index) { | 99 int field_index) { |
100 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD); | 100 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD); |
101 Object* code = receiver->map()->FindInCodeCache(name, flags); | 101 Object* code = receiver->map()->FindInCodeCache(name, flags); |
102 if (code->IsUndefined()) { | 102 if (code->IsUndefined()) { |
103 LoadStubCompiler compiler; | 103 LoadStubCompiler compiler; |
104 code = compiler.CompileLoadField(receiver, holder, field_index, name); | 104 code = compiler.CompileLoadField(receiver, holder, field_index, name); |
105 if (code->IsFailure()) return code; | 105 if (code->IsFailure()) return code; |
106 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 106 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
107 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 107 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
108 if (result->IsFailure()) return result; | 108 if (result->IsFailure()) return result; |
109 } | 109 } |
110 return Set(name, receiver->map(), Code::cast(code)); | 110 return Set(name, receiver->map(), Code::cast(code)); |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 Object* StubCache::ComputeLoadCallback(String* name, | 114 Object* StubCache::ComputeLoadCallback(String* name, |
115 JSObject* receiver, | 115 JSObject* receiver, |
116 JSObject* holder, | 116 JSObject* holder, |
117 AccessorInfo* callback) { | 117 AccessorInfo* callback) { |
118 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); | 118 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); |
119 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, CALLBACKS); | 119 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, CALLBACKS); |
120 Object* code = receiver->map()->FindInCodeCache(name, flags); | 120 Object* code = receiver->map()->FindInCodeCache(name, flags); |
121 if (code->IsUndefined()) { | 121 if (code->IsUndefined()) { |
122 LoadStubCompiler compiler; | 122 LoadStubCompiler compiler; |
123 code = compiler.CompileLoadCallback(name, receiver, holder, callback); | 123 code = compiler.CompileLoadCallback(name, receiver, holder, callback); |
124 if (code->IsFailure()) return code; | 124 if (code->IsFailure()) return code; |
125 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 125 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
126 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 126 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
127 if (result->IsFailure()) return result; | 127 if (result->IsFailure()) return result; |
128 } | 128 } |
129 return Set(name, receiver->map(), Code::cast(code)); | 129 return Set(name, receiver->map(), Code::cast(code)); |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 Object* StubCache::ComputeLoadConstant(String* name, | 133 Object* StubCache::ComputeLoadConstant(String* name, |
134 JSObject* receiver, | 134 JSObject* receiver, |
135 JSObject* holder, | 135 JSObject* holder, |
136 Object* value) { | 136 Object* value) { |
137 Code::Flags flags = | 137 Code::Flags flags = |
138 Code::ComputeMonomorphicFlags(Code::LOAD_IC, CONSTANT_FUNCTION); | 138 Code::ComputeMonomorphicFlags(Code::LOAD_IC, CONSTANT_FUNCTION); |
139 Object* code = receiver->map()->FindInCodeCache(name, flags); | 139 Object* code = receiver->map()->FindInCodeCache(name, flags); |
140 if (code->IsUndefined()) { | 140 if (code->IsUndefined()) { |
141 LoadStubCompiler compiler; | 141 LoadStubCompiler compiler; |
142 code = compiler.CompileLoadConstant(receiver, holder, value, name); | 142 code = compiler.CompileLoadConstant(receiver, holder, value, name); |
143 if (code->IsFailure()) return code; | 143 if (code->IsFailure()) return code; |
144 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 144 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
145 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 145 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
146 if (result->IsFailure()) return result; | 146 if (result->IsFailure()) return result; |
147 } | 147 } |
148 return Set(name, receiver->map(), Code::cast(code)); | 148 return Set(name, receiver->map(), Code::cast(code)); |
149 } | 149 } |
150 | 150 |
151 | 151 |
152 Object* StubCache::ComputeLoadInterceptor(String* name, | 152 Object* StubCache::ComputeLoadInterceptor(String* name, |
153 JSObject* receiver, | 153 JSObject* receiver, |
154 JSObject* holder) { | 154 JSObject* holder) { |
155 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, INTERCEPTOR); | 155 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, INTERCEPTOR); |
156 Object* code = receiver->map()->FindInCodeCache(name, flags); | 156 Object* code = receiver->map()->FindInCodeCache(name, flags); |
157 if (code->IsUndefined()) { | 157 if (code->IsUndefined()) { |
158 LoadStubCompiler compiler; | 158 LoadStubCompiler compiler; |
159 code = compiler.CompileLoadInterceptor(receiver, holder, name); | 159 code = compiler.CompileLoadInterceptor(receiver, holder, name); |
160 if (code->IsFailure()) return code; | 160 if (code->IsFailure()) return code; |
161 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 161 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
162 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 162 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
163 if (result->IsFailure()) return result; | 163 if (result->IsFailure()) return result; |
164 } | 164 } |
165 return Set(name, receiver->map(), Code::cast(code)); | 165 return Set(name, receiver->map(), Code::cast(code)); |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 Object* StubCache::ComputeLoadNormal(String* name, JSObject* receiver) { | 169 Object* StubCache::ComputeLoadNormal(String* name, JSObject* receiver) { |
170 Code* code = Builtins::builtin(Builtins::LoadIC_Normal); | 170 Code* code = Builtins::builtin(Builtins::LoadIC_Normal); |
171 return Set(name, receiver->map(), code); | 171 return Set(name, receiver->map(), code); |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 Object* StubCache::ComputeLoadGlobal(String* name, | 175 Object* StubCache::ComputeLoadGlobal(String* name, |
176 JSObject* receiver, | 176 JSObject* receiver, |
177 GlobalObject* holder, | 177 GlobalObject* holder, |
178 JSGlobalPropertyCell* cell, | 178 JSGlobalPropertyCell* cell, |
179 bool is_dont_delete) { | 179 bool is_dont_delete) { |
180 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); | 180 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); |
181 Object* code = receiver->map()->FindInCodeCache(name, flags); | 181 Object* code = receiver->map()->FindInCodeCache(name, flags); |
182 if (code->IsUndefined()) { | 182 if (code->IsUndefined()) { |
183 LoadStubCompiler compiler; | 183 LoadStubCompiler compiler; |
184 code = compiler.CompileLoadGlobal(receiver, | 184 code = compiler.CompileLoadGlobal(receiver, |
185 holder, | 185 holder, |
186 cell, | 186 cell, |
187 name, | 187 name, |
188 is_dont_delete); | 188 is_dont_delete); |
189 if (code->IsFailure()) return code; | 189 if (code->IsFailure()) return code; |
190 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 190 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
191 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 191 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
192 if (result->IsFailure()) return result; | 192 if (result->IsFailure()) return result; |
193 } | 193 } |
194 return Set(name, receiver->map(), Code::cast(code)); | 194 return Set(name, receiver->map(), Code::cast(code)); |
195 } | 195 } |
196 | 196 |
197 | 197 |
198 Object* StubCache::ComputeKeyedLoadField(String* name, | 198 Object* StubCache::ComputeKeyedLoadField(String* name, |
199 JSObject* receiver, | 199 JSObject* receiver, |
200 JSObject* holder, | 200 JSObject* holder, |
201 int field_index) { | 201 int field_index) { |
202 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, FIELD); | 202 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, FIELD); |
203 Object* code = receiver->map()->FindInCodeCache(name, flags); | 203 Object* code = receiver->map()->FindInCodeCache(name, flags); |
204 if (code->IsUndefined()) { | 204 if (code->IsUndefined()) { |
205 KeyedLoadStubCompiler compiler; | 205 KeyedLoadStubCompiler compiler; |
206 code = compiler.CompileLoadField(name, receiver, holder, field_index); | 206 code = compiler.CompileLoadField(name, receiver, holder, field_index); |
207 if (code->IsFailure()) return code; | 207 if (code->IsFailure()) return code; |
208 LOG(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 208 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
209 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 209 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
210 if (result->IsFailure()) return result; | 210 if (result->IsFailure()) return result; |
211 } | 211 } |
212 return code; | 212 return code; |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 Object* StubCache::ComputeKeyedLoadConstant(String* name, | 216 Object* StubCache::ComputeKeyedLoadConstant(String* name, |
217 JSObject* receiver, | 217 JSObject* receiver, |
218 JSObject* holder, | 218 JSObject* holder, |
219 Object* value) { | 219 Object* value) { |
220 Code::Flags flags = | 220 Code::Flags flags = |
221 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CONSTANT_FUNCTION); | 221 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CONSTANT_FUNCTION); |
222 Object* code = receiver->map()->FindInCodeCache(name, flags); | 222 Object* code = receiver->map()->FindInCodeCache(name, flags); |
223 if (code->IsUndefined()) { | 223 if (code->IsUndefined()) { |
224 KeyedLoadStubCompiler compiler; | 224 KeyedLoadStubCompiler compiler; |
225 code = compiler.CompileLoadConstant(name, receiver, holder, value); | 225 code = compiler.CompileLoadConstant(name, receiver, holder, value); |
226 if (code->IsFailure()) return code; | 226 if (code->IsFailure()) return code; |
227 LOG(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 227 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
228 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 228 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
229 if (result->IsFailure()) return result; | 229 if (result->IsFailure()) return result; |
230 } | 230 } |
231 return code; | 231 return code; |
232 } | 232 } |
233 | 233 |
234 | 234 |
235 Object* StubCache::ComputeKeyedLoadInterceptor(String* name, | 235 Object* StubCache::ComputeKeyedLoadInterceptor(String* name, |
236 JSObject* receiver, | 236 JSObject* receiver, |
237 JSObject* holder) { | 237 JSObject* holder) { |
238 Code::Flags flags = | 238 Code::Flags flags = |
239 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, INTERCEPTOR); | 239 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, INTERCEPTOR); |
240 Object* code = receiver->map()->FindInCodeCache(name, flags); | 240 Object* code = receiver->map()->FindInCodeCache(name, flags); |
241 if (code->IsUndefined()) { | 241 if (code->IsUndefined()) { |
242 KeyedLoadStubCompiler compiler; | 242 KeyedLoadStubCompiler compiler; |
243 code = compiler.CompileLoadInterceptor(receiver, holder, name); | 243 code = compiler.CompileLoadInterceptor(receiver, holder, name); |
244 if (code->IsFailure()) return code; | 244 if (code->IsFailure()) return code; |
245 LOG(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 245 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
246 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 246 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
247 if (result->IsFailure()) return result; | 247 if (result->IsFailure()) return result; |
248 } | 248 } |
249 return code; | 249 return code; |
250 } | 250 } |
251 | 251 |
252 | 252 |
253 Object* StubCache::ComputeKeyedLoadCallback(String* name, | 253 Object* StubCache::ComputeKeyedLoadCallback(String* name, |
254 JSObject* receiver, | 254 JSObject* receiver, |
255 JSObject* holder, | 255 JSObject* holder, |
256 AccessorInfo* callback) { | 256 AccessorInfo* callback) { |
257 Code::Flags flags = | 257 Code::Flags flags = |
258 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 258 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
259 Object* code = receiver->map()->FindInCodeCache(name, flags); | 259 Object* code = receiver->map()->FindInCodeCache(name, flags); |
260 if (code->IsUndefined()) { | 260 if (code->IsUndefined()) { |
261 KeyedLoadStubCompiler compiler; | 261 KeyedLoadStubCompiler compiler; |
262 code = compiler.CompileLoadCallback(name, receiver, holder, callback); | 262 code = compiler.CompileLoadCallback(name, receiver, holder, callback); |
263 if (code->IsFailure()) return code; | 263 if (code->IsFailure()) return code; |
264 LOG(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 264 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
265 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 265 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
266 if (result->IsFailure()) return result; | 266 if (result->IsFailure()) return result; |
267 } | 267 } |
268 return code; | 268 return code; |
269 } | 269 } |
270 | 270 |
271 | 271 |
272 | 272 |
273 Object* StubCache::ComputeKeyedLoadArrayLength(String* name, | 273 Object* StubCache::ComputeKeyedLoadArrayLength(String* name, |
274 JSArray* receiver) { | 274 JSArray* receiver) { |
275 Code::Flags flags = | 275 Code::Flags flags = |
276 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 276 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
277 Object* code = receiver->map()->FindInCodeCache(name, flags); | 277 Object* code = receiver->map()->FindInCodeCache(name, flags); |
278 if (code->IsUndefined()) { | 278 if (code->IsUndefined()) { |
279 KeyedLoadStubCompiler compiler; | 279 KeyedLoadStubCompiler compiler; |
280 code = compiler.CompileLoadArrayLength(name); | 280 code = compiler.CompileLoadArrayLength(name); |
281 if (code->IsFailure()) return code; | 281 if (code->IsFailure()) return code; |
282 LOG(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 282 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
283 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 283 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
284 if (result->IsFailure()) return result; | 284 if (result->IsFailure()) return result; |
285 } | 285 } |
286 return code; | 286 return code; |
287 } | 287 } |
288 | 288 |
289 | 289 |
290 Object* StubCache::ComputeKeyedLoadStringLength(String* name, | 290 Object* StubCache::ComputeKeyedLoadStringLength(String* name, |
291 String* receiver) { | 291 String* receiver) { |
292 Code::Flags flags = | 292 Code::Flags flags = |
293 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 293 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
294 Object* code = receiver->map()->FindInCodeCache(name, flags); | 294 Object* code = receiver->map()->FindInCodeCache(name, flags); |
295 if (code->IsUndefined()) { | 295 if (code->IsUndefined()) { |
296 KeyedLoadStubCompiler compiler; | 296 KeyedLoadStubCompiler compiler; |
297 code = compiler.CompileLoadStringLength(name); | 297 code = compiler.CompileLoadStringLength(name); |
298 if (code->IsFailure()) return code; | 298 if (code->IsFailure()) return code; |
299 LOG(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 299 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
300 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 300 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
301 if (result->IsFailure()) return result; | 301 if (result->IsFailure()) return result; |
302 } | 302 } |
303 return code; | 303 return code; |
304 } | 304 } |
305 | 305 |
306 | 306 |
307 Object* StubCache::ComputeKeyedLoadFunctionPrototype(String* name, | 307 Object* StubCache::ComputeKeyedLoadFunctionPrototype(String* name, |
308 JSFunction* receiver) { | 308 JSFunction* receiver) { |
309 Code::Flags flags = | 309 Code::Flags flags = |
310 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 310 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
311 Object* code = receiver->map()->FindInCodeCache(name, flags); | 311 Object* code = receiver->map()->FindInCodeCache(name, flags); |
312 if (code->IsUndefined()) { | 312 if (code->IsUndefined()) { |
313 KeyedLoadStubCompiler compiler; | 313 KeyedLoadStubCompiler compiler; |
314 code = compiler.CompileLoadFunctionPrototype(name); | 314 code = compiler.CompileLoadFunctionPrototype(name); |
315 if (code->IsFailure()) return code; | 315 if (code->IsFailure()) return code; |
316 LOG(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 316 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
317 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 317 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
318 if (result->IsFailure()) return result; | 318 if (result->IsFailure()) return result; |
319 } | 319 } |
320 return code; | 320 return code; |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 Object* StubCache::ComputeStoreField(String* name, | 324 Object* StubCache::ComputeStoreField(String* name, |
325 JSObject* receiver, | 325 JSObject* receiver, |
326 int field_index, | 326 int field_index, |
327 Map* transition) { | 327 Map* transition) { |
328 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; | 328 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; |
329 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); | 329 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); |
330 Object* code = receiver->map()->FindInCodeCache(name, flags); | 330 Object* code = receiver->map()->FindInCodeCache(name, flags); |
331 if (code->IsUndefined()) { | 331 if (code->IsUndefined()) { |
332 StoreStubCompiler compiler; | 332 StoreStubCompiler compiler; |
333 code = compiler.CompileStoreField(receiver, field_index, transition, name); | 333 code = compiler.CompileStoreField(receiver, field_index, transition, name); |
334 if (code->IsFailure()) return code; | 334 if (code->IsFailure()) return code; |
335 LOG(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 335 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
336 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 336 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
337 if (result->IsFailure()) return result; | 337 if (result->IsFailure()) return result; |
338 } | 338 } |
339 return Set(name, receiver->map(), Code::cast(code)); | 339 return Set(name, receiver->map(), Code::cast(code)); |
340 } | 340 } |
341 | 341 |
342 | 342 |
343 Object* StubCache::ComputeStoreGlobal(String* name, | 343 Object* StubCache::ComputeStoreGlobal(String* name, |
344 GlobalObject* receiver, | 344 GlobalObject* receiver, |
345 JSGlobalPropertyCell* cell) { | 345 JSGlobalPropertyCell* cell) { |
346 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); | 346 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); |
347 Object* code = receiver->map()->FindInCodeCache(name, flags); | 347 Object* code = receiver->map()->FindInCodeCache(name, flags); |
348 if (code->IsUndefined()) { | 348 if (code->IsUndefined()) { |
349 StoreStubCompiler compiler; | 349 StoreStubCompiler compiler; |
350 code = compiler.CompileStoreGlobal(receiver, cell, name); | 350 code = compiler.CompileStoreGlobal(receiver, cell, name); |
351 if (code->IsFailure()) return code; | 351 if (code->IsFailure()) return code; |
352 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 352 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
353 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 353 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
354 if (result->IsFailure()) return result; | 354 if (result->IsFailure()) return result; |
355 } | 355 } |
356 return Set(name, receiver->map(), Code::cast(code)); | 356 return Set(name, receiver->map(), Code::cast(code)); |
357 } | 357 } |
358 | 358 |
359 | 359 |
360 Object* StubCache::ComputeStoreCallback(String* name, | 360 Object* StubCache::ComputeStoreCallback(String* name, |
361 JSObject* receiver, | 361 JSObject* receiver, |
362 AccessorInfo* callback) { | 362 AccessorInfo* callback) { |
363 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); | 363 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); |
364 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, CALLBACKS); | 364 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, CALLBACKS); |
365 Object* code = receiver->map()->FindInCodeCache(name, flags); | 365 Object* code = receiver->map()->FindInCodeCache(name, flags); |
366 if (code->IsUndefined()) { | 366 if (code->IsUndefined()) { |
367 StoreStubCompiler compiler; | 367 StoreStubCompiler compiler; |
368 code = compiler.CompileStoreCallback(receiver, callback, name); | 368 code = compiler.CompileStoreCallback(receiver, callback, name); |
369 if (code->IsFailure()) return code; | 369 if (code->IsFailure()) return code; |
370 LOG(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 370 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
371 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 371 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
372 if (result->IsFailure()) return result; | 372 if (result->IsFailure()) return result; |
373 } | 373 } |
374 return Set(name, receiver->map(), Code::cast(code)); | 374 return Set(name, receiver->map(), Code::cast(code)); |
375 } | 375 } |
376 | 376 |
377 | 377 |
378 Object* StubCache::ComputeStoreInterceptor(String* name, | 378 Object* StubCache::ComputeStoreInterceptor(String* name, |
379 JSObject* receiver) { | 379 JSObject* receiver) { |
380 Code::Flags flags = | 380 Code::Flags flags = |
381 Code::ComputeMonomorphicFlags(Code::STORE_IC, INTERCEPTOR); | 381 Code::ComputeMonomorphicFlags(Code::STORE_IC, INTERCEPTOR); |
382 Object* code = receiver->map()->FindInCodeCache(name, flags); | 382 Object* code = receiver->map()->FindInCodeCache(name, flags); |
383 if (code->IsUndefined()) { | 383 if (code->IsUndefined()) { |
384 StoreStubCompiler compiler; | 384 StoreStubCompiler compiler; |
385 code = compiler.CompileStoreInterceptor(receiver, name); | 385 code = compiler.CompileStoreInterceptor(receiver, name); |
386 if (code->IsFailure()) return code; | 386 if (code->IsFailure()) return code; |
387 LOG(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 387 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
388 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 388 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
389 if (result->IsFailure()) return result; | 389 if (result->IsFailure()) return result; |
390 } | 390 } |
391 return Set(name, receiver->map(), Code::cast(code)); | 391 return Set(name, receiver->map(), Code::cast(code)); |
392 } | 392 } |
393 | 393 |
394 | 394 |
395 Object* StubCache::ComputeKeyedStoreField(String* name, JSObject* receiver, | 395 Object* StubCache::ComputeKeyedStoreField(String* name, JSObject* receiver, |
396 int field_index, Map* transition) { | 396 int field_index, Map* transition) { |
397 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; | 397 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; |
398 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); | 398 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); |
399 Object* code = receiver->map()->FindInCodeCache(name, flags); | 399 Object* code = receiver->map()->FindInCodeCache(name, flags); |
400 if (code->IsUndefined()) { | 400 if (code->IsUndefined()) { |
401 KeyedStoreStubCompiler compiler; | 401 KeyedStoreStubCompiler compiler; |
402 code = compiler.CompileStoreField(receiver, field_index, transition, name); | 402 code = compiler.CompileStoreField(receiver, field_index, transition, name); |
403 if (code->IsFailure()) return code; | 403 if (code->IsFailure()) return code; |
404 LOG(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), name)); | 404 PROFILE(CodeCreateEvent( |
| 405 Logger::KEYED_STORE_IC_TAG, Code::cast(code), name)); |
405 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 406 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
406 if (result->IsFailure()) return result; | 407 if (result->IsFailure()) return result; |
407 } | 408 } |
408 return code; | 409 return code; |
409 } | 410 } |
410 | 411 |
411 | 412 |
412 Object* StubCache::ComputeCallConstant(int argc, | 413 Object* StubCache::ComputeCallConstant(int argc, |
413 InLoopFlag in_loop, | 414 InLoopFlag in_loop, |
414 String* name, | 415 String* name, |
(...skipping 23 matching lines...) Expand all Loading... |
438 // If the function hasn't been compiled yet, we cannot do it now | 439 // If the function hasn't been compiled yet, we cannot do it now |
439 // because it may cause GC. To avoid this issue, we return an | 440 // because it may cause GC. To avoid this issue, we return an |
440 // internal error which will make sure we do not update any | 441 // internal error which will make sure we do not update any |
441 // caches. | 442 // caches. |
442 if (!function->is_compiled()) return Failure::InternalError(); | 443 if (!function->is_compiled()) return Failure::InternalError(); |
443 // Compile the stub - only create stubs for fully compiled functions. | 444 // Compile the stub - only create stubs for fully compiled functions. |
444 CallStubCompiler compiler(argc, in_loop); | 445 CallStubCompiler compiler(argc, in_loop); |
445 code = compiler.CompileCallConstant(object, holder, function, name, check); | 446 code = compiler.CompileCallConstant(object, holder, function, name, check); |
446 if (code->IsFailure()) return code; | 447 if (code->IsFailure()) return code; |
447 ASSERT_EQ(flags, Code::cast(code)->flags()); | 448 ASSERT_EQ(flags, Code::cast(code)->flags()); |
448 LOG(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); | 449 PROFILE(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); |
449 Object* result = map->UpdateCodeCache(name, Code::cast(code)); | 450 Object* result = map->UpdateCodeCache(name, Code::cast(code)); |
450 if (result->IsFailure()) return result; | 451 if (result->IsFailure()) return result; |
451 } | 452 } |
452 return Set(name, map, Code::cast(code)); | 453 return Set(name, map, Code::cast(code)); |
453 } | 454 } |
454 | 455 |
455 | 456 |
456 Object* StubCache::ComputeCallField(int argc, | 457 Object* StubCache::ComputeCallField(int argc, |
457 InLoopFlag in_loop, | 458 InLoopFlag in_loop, |
458 String* name, | 459 String* name, |
(...skipping 16 matching lines...) Expand all Loading... |
475 argc); | 476 argc); |
476 Object* code = map->FindInCodeCache(name, flags); | 477 Object* code = map->FindInCodeCache(name, flags); |
477 if (code->IsUndefined()) { | 478 if (code->IsUndefined()) { |
478 CallStubCompiler compiler(argc, in_loop); | 479 CallStubCompiler compiler(argc, in_loop); |
479 code = compiler.CompileCallField(JSObject::cast(object), | 480 code = compiler.CompileCallField(JSObject::cast(object), |
480 holder, | 481 holder, |
481 index, | 482 index, |
482 name); | 483 name); |
483 if (code->IsFailure()) return code; | 484 if (code->IsFailure()) return code; |
484 ASSERT_EQ(flags, Code::cast(code)->flags()); | 485 ASSERT_EQ(flags, Code::cast(code)->flags()); |
485 LOG(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); | 486 PROFILE(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); |
486 Object* result = map->UpdateCodeCache(name, Code::cast(code)); | 487 Object* result = map->UpdateCodeCache(name, Code::cast(code)); |
487 if (result->IsFailure()) return result; | 488 if (result->IsFailure()) return result; |
488 } | 489 } |
489 return Set(name, map, Code::cast(code)); | 490 return Set(name, map, Code::cast(code)); |
490 } | 491 } |
491 | 492 |
492 | 493 |
493 Object* StubCache::ComputeCallInterceptor(int argc, | 494 Object* StubCache::ComputeCallInterceptor(int argc, |
494 String* name, | 495 String* name, |
495 Object* object, | 496 Object* object, |
(...skipping 15 matching lines...) Expand all Loading... |
511 NOT_IN_LOOP, | 512 NOT_IN_LOOP, |
512 argc); | 513 argc); |
513 Object* code = map->FindInCodeCache(name, flags); | 514 Object* code = map->FindInCodeCache(name, flags); |
514 if (code->IsUndefined()) { | 515 if (code->IsUndefined()) { |
515 CallStubCompiler compiler(argc, NOT_IN_LOOP); | 516 CallStubCompiler compiler(argc, NOT_IN_LOOP); |
516 code = compiler.CompileCallInterceptor(JSObject::cast(object), | 517 code = compiler.CompileCallInterceptor(JSObject::cast(object), |
517 holder, | 518 holder, |
518 name); | 519 name); |
519 if (code->IsFailure()) return code; | 520 if (code->IsFailure()) return code; |
520 ASSERT_EQ(flags, Code::cast(code)->flags()); | 521 ASSERT_EQ(flags, Code::cast(code)->flags()); |
521 LOG(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); | 522 PROFILE(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); |
522 Object* result = map->UpdateCodeCache(name, Code::cast(code)); | 523 Object* result = map->UpdateCodeCache(name, Code::cast(code)); |
523 if (result->IsFailure()) return result; | 524 if (result->IsFailure()) return result; |
524 } | 525 } |
525 return Set(name, map, Code::cast(code)); | 526 return Set(name, map, Code::cast(code)); |
526 } | 527 } |
527 | 528 |
528 | 529 |
529 Object* StubCache::ComputeCallNormal(int argc, | 530 Object* StubCache::ComputeCallNormal(int argc, |
530 InLoopFlag in_loop, | 531 InLoopFlag in_loop, |
531 String* name, | 532 String* name, |
(...skipping 17 matching lines...) Expand all Loading... |
549 if (code->IsUndefined()) { | 550 if (code->IsUndefined()) { |
550 // If the function hasn't been compiled yet, we cannot do it now | 551 // If the function hasn't been compiled yet, we cannot do it now |
551 // because it may cause GC. To avoid this issue, we return an | 552 // because it may cause GC. To avoid this issue, we return an |
552 // internal error which will make sure we do not update any | 553 // internal error which will make sure we do not update any |
553 // caches. | 554 // caches. |
554 if (!function->is_compiled()) return Failure::InternalError(); | 555 if (!function->is_compiled()) return Failure::InternalError(); |
555 CallStubCompiler compiler(argc, in_loop); | 556 CallStubCompiler compiler(argc, in_loop); |
556 code = compiler.CompileCallGlobal(receiver, holder, cell, function, name); | 557 code = compiler.CompileCallGlobal(receiver, holder, cell, function, name); |
557 if (code->IsFailure()) return code; | 558 if (code->IsFailure()) return code; |
558 ASSERT_EQ(flags, Code::cast(code)->flags()); | 559 ASSERT_EQ(flags, Code::cast(code)->flags()); |
559 LOG(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); | 560 PROFILE(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); |
560 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 561 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
561 if (result->IsFailure()) return result; | 562 if (result->IsFailure()) return result; |
562 } | 563 } |
563 return Set(name, receiver->map(), Code::cast(code)); | 564 return Set(name, receiver->map(), Code::cast(code)); |
564 } | 565 } |
565 | 566 |
566 | 567 |
567 static Object* GetProbeValue(Code::Flags flags) { | 568 static Object* GetProbeValue(Code::Flags flags) { |
568 // Use raw_unchecked... so we don't get assert failures during GC. | 569 // Use raw_unchecked... so we don't get assert failures during GC. |
569 NumberDictionary* dictionary = Heap::raw_unchecked_non_monomorphic_cache(); | 570 NumberDictionary* dictionary = Heap::raw_unchecked_non_monomorphic_cache(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 Object* StubCache::ComputeLazyCompile(int argc) { | 695 Object* StubCache::ComputeLazyCompile(int argc) { |
695 Code::Flags flags = | 696 Code::Flags flags = |
696 Code::ComputeFlags(Code::STUB, NOT_IN_LOOP, UNINITIALIZED, NORMAL, argc); | 697 Code::ComputeFlags(Code::STUB, NOT_IN_LOOP, UNINITIALIZED, NORMAL, argc); |
697 Object* probe = ProbeCache(flags); | 698 Object* probe = ProbeCache(flags); |
698 if (!probe->IsUndefined()) return probe; | 699 if (!probe->IsUndefined()) return probe; |
699 StubCompiler compiler; | 700 StubCompiler compiler; |
700 Object* result = FillCache(compiler.CompileLazyCompile(flags)); | 701 Object* result = FillCache(compiler.CompileLazyCompile(flags)); |
701 if (result->IsCode()) { | 702 if (result->IsCode()) { |
702 Code* code = Code::cast(result); | 703 Code* code = Code::cast(result); |
703 USE(code); | 704 USE(code); |
704 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, | 705 PROFILE(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, |
705 code, code->arguments_count())); | 706 code, code->arguments_count())); |
706 } | 707 } |
707 return result; | 708 return result; |
708 } | 709 } |
709 | 710 |
710 | 711 |
711 void StubCache::Clear() { | 712 void StubCache::Clear() { |
712 for (int i = 0; i < kPrimaryTableSize; i++) { | 713 for (int i = 0; i < kPrimaryTableSize; i++) { |
713 primary_[i].key = Heap::empty_string(); | 714 primary_[i].key = Heap::empty_string(); |
714 primary_[i].value = Builtins::builtin(Builtins::Illegal); | 715 primary_[i].value = Builtins::builtin(Builtins::Illegal); |
715 } | 716 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 | 933 |
933 Object* StubCompiler::CompileCallInitialize(Code::Flags flags) { | 934 Object* StubCompiler::CompileCallInitialize(Code::Flags flags) { |
934 HandleScope scope; | 935 HandleScope scope; |
935 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 936 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
936 CallIC::GenerateInitialize(masm(), argc); | 937 CallIC::GenerateInitialize(masm(), argc); |
937 Object* result = GetCodeWithFlags(flags, "CompileCallInitialize"); | 938 Object* result = GetCodeWithFlags(flags, "CompileCallInitialize"); |
938 if (!result->IsFailure()) { | 939 if (!result->IsFailure()) { |
939 Counters::call_initialize_stubs.Increment(); | 940 Counters::call_initialize_stubs.Increment(); |
940 Code* code = Code::cast(result); | 941 Code* code = Code::cast(result); |
941 USE(code); | 942 USE(code); |
942 LOG(CodeCreateEvent(Logger::CALL_INITIALIZE_TAG, | 943 PROFILE(CodeCreateEvent(Logger::CALL_INITIALIZE_TAG, |
943 code, code->arguments_count())); | 944 code, code->arguments_count())); |
944 } | 945 } |
945 return result; | 946 return result; |
946 } | 947 } |
947 | 948 |
948 | 949 |
949 Object* StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) { | 950 Object* StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) { |
950 HandleScope scope; | 951 HandleScope scope; |
951 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 952 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
952 // The code of the PreMonomorphic stub is the same as the code | 953 // The code of the PreMonomorphic stub is the same as the code |
953 // of the Initialized stub. They just differ on the code object flags. | 954 // of the Initialized stub. They just differ on the code object flags. |
954 CallIC::GenerateInitialize(masm(), argc); | 955 CallIC::GenerateInitialize(masm(), argc); |
955 Object* result = GetCodeWithFlags(flags, "CompileCallPreMonomorphic"); | 956 Object* result = GetCodeWithFlags(flags, "CompileCallPreMonomorphic"); |
956 if (!result->IsFailure()) { | 957 if (!result->IsFailure()) { |
957 Counters::call_premonomorphic_stubs.Increment(); | 958 Counters::call_premonomorphic_stubs.Increment(); |
958 Code* code = Code::cast(result); | 959 Code* code = Code::cast(result); |
959 USE(code); | 960 USE(code); |
960 LOG(CodeCreateEvent(Logger::CALL_PRE_MONOMORPHIC_TAG, | 961 PROFILE(CodeCreateEvent(Logger::CALL_PRE_MONOMORPHIC_TAG, |
961 code, code->arguments_count())); | 962 code, code->arguments_count())); |
962 } | 963 } |
963 return result; | 964 return result; |
964 } | 965 } |
965 | 966 |
966 | 967 |
967 Object* StubCompiler::CompileCallNormal(Code::Flags flags) { | 968 Object* StubCompiler::CompileCallNormal(Code::Flags flags) { |
968 HandleScope scope; | 969 HandleScope scope; |
969 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 970 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
970 CallIC::GenerateNormal(masm(), argc); | 971 CallIC::GenerateNormal(masm(), argc); |
971 Object* result = GetCodeWithFlags(flags, "CompileCallNormal"); | 972 Object* result = GetCodeWithFlags(flags, "CompileCallNormal"); |
972 if (!result->IsFailure()) { | 973 if (!result->IsFailure()) { |
973 Counters::call_normal_stubs.Increment(); | 974 Counters::call_normal_stubs.Increment(); |
974 Code* code = Code::cast(result); | 975 Code* code = Code::cast(result); |
975 USE(code); | 976 USE(code); |
976 LOG(CodeCreateEvent(Logger::CALL_NORMAL_TAG, | 977 PROFILE(CodeCreateEvent(Logger::CALL_NORMAL_TAG, |
977 code, code->arguments_count())); | 978 code, code->arguments_count())); |
978 } | 979 } |
979 return result; | 980 return result; |
980 } | 981 } |
981 | 982 |
982 | 983 |
983 Object* StubCompiler::CompileCallMegamorphic(Code::Flags flags) { | 984 Object* StubCompiler::CompileCallMegamorphic(Code::Flags flags) { |
984 HandleScope scope; | 985 HandleScope scope; |
985 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 986 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
986 CallIC::GenerateMegamorphic(masm(), argc); | 987 CallIC::GenerateMegamorphic(masm(), argc); |
987 Object* result = GetCodeWithFlags(flags, "CompileCallMegamorphic"); | 988 Object* result = GetCodeWithFlags(flags, "CompileCallMegamorphic"); |
988 if (!result->IsFailure()) { | 989 if (!result->IsFailure()) { |
989 Counters::call_megamorphic_stubs.Increment(); | 990 Counters::call_megamorphic_stubs.Increment(); |
990 Code* code = Code::cast(result); | 991 Code* code = Code::cast(result); |
991 USE(code); | 992 USE(code); |
992 LOG(CodeCreateEvent(Logger::CALL_MEGAMORPHIC_TAG, | 993 PROFILE(CodeCreateEvent(Logger::CALL_MEGAMORPHIC_TAG, |
993 code, code->arguments_count())); | 994 code, code->arguments_count())); |
994 } | 995 } |
995 return result; | 996 return result; |
996 } | 997 } |
997 | 998 |
998 | 999 |
999 Object* StubCompiler::CompileCallMiss(Code::Flags flags) { | 1000 Object* StubCompiler::CompileCallMiss(Code::Flags flags) { |
1000 HandleScope scope; | 1001 HandleScope scope; |
1001 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1002 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1002 CallIC::GenerateMiss(masm(), argc); | 1003 CallIC::GenerateMiss(masm(), argc); |
1003 Object* result = GetCodeWithFlags(flags, "CompileCallMiss"); | 1004 Object* result = GetCodeWithFlags(flags, "CompileCallMiss"); |
1004 if (!result->IsFailure()) { | 1005 if (!result->IsFailure()) { |
1005 Counters::call_megamorphic_stubs.Increment(); | 1006 Counters::call_megamorphic_stubs.Increment(); |
1006 Code* code = Code::cast(result); | 1007 Code* code = Code::cast(result); |
1007 USE(code); | 1008 USE(code); |
1008 LOG(CodeCreateEvent(Logger::CALL_MISS_TAG, code, code->arguments_count())); | 1009 PROFILE(CodeCreateEvent(Logger::CALL_MISS_TAG, |
| 1010 code, code->arguments_count())); |
1009 } | 1011 } |
1010 return result; | 1012 return result; |
1011 } | 1013 } |
1012 | 1014 |
1013 | 1015 |
1014 #ifdef ENABLE_DEBUGGER_SUPPORT | 1016 #ifdef ENABLE_DEBUGGER_SUPPORT |
1015 Object* StubCompiler::CompileCallDebugBreak(Code::Flags flags) { | 1017 Object* StubCompiler::CompileCallDebugBreak(Code::Flags flags) { |
1016 HandleScope scope; | 1018 HandleScope scope; |
1017 Debug::GenerateCallICDebugBreak(masm()); | 1019 Debug::GenerateCallICDebugBreak(masm()); |
1018 Object* result = GetCodeWithFlags(flags, "CompileCallDebugBreak"); | 1020 Object* result = GetCodeWithFlags(flags, "CompileCallDebugBreak"); |
1019 if (!result->IsFailure()) { | 1021 if (!result->IsFailure()) { |
1020 Code* code = Code::cast(result); | 1022 Code* code = Code::cast(result); |
1021 USE(code); | 1023 USE(code); |
1022 LOG(CodeCreateEvent(Logger::CALL_DEBUG_BREAK_TAG, | 1024 PROFILE(CodeCreateEvent(Logger::CALL_DEBUG_BREAK_TAG, |
1023 code, code->arguments_count())); | 1025 code, code->arguments_count())); |
1024 } | 1026 } |
1025 return result; | 1027 return result; |
1026 } | 1028 } |
1027 | 1029 |
1028 | 1030 |
1029 Object* StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) { | 1031 Object* StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) { |
1030 HandleScope scope; | 1032 HandleScope scope; |
1031 // Use the same code for the the step in preparations as we do for | 1033 // Use the same code for the the step in preparations as we do for |
1032 // the miss case. | 1034 // the miss case. |
1033 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1035 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1034 CallIC::GenerateMiss(masm(), argc); | 1036 CallIC::GenerateMiss(masm(), argc); |
1035 Object* result = GetCodeWithFlags(flags, "CompileCallDebugPrepareStepIn"); | 1037 Object* result = GetCodeWithFlags(flags, "CompileCallDebugPrepareStepIn"); |
1036 if (!result->IsFailure()) { | 1038 if (!result->IsFailure()) { |
1037 Code* code = Code::cast(result); | 1039 Code* code = Code::cast(result); |
1038 USE(code); | 1040 USE(code); |
1039 LOG(CodeCreateEvent(Logger::CALL_DEBUG_PREPARE_STEP_IN_TAG, | 1041 PROFILE(CodeCreateEvent(Logger::CALL_DEBUG_PREPARE_STEP_IN_TAG, |
1040 code, code->arguments_count())); | 1042 code, code->arguments_count())); |
1041 } | 1043 } |
1042 return result; | 1044 return result; |
1043 } | 1045 } |
1044 #endif | 1046 #endif |
1045 | 1047 |
1046 | 1048 |
1047 Object* StubCompiler::GetCodeWithFlags(Code::Flags flags, const char* name) { | 1049 Object* StubCompiler::GetCodeWithFlags(Code::Flags flags, const char* name) { |
1048 // Check for allocation failures during stub compilation. | 1050 // Check for allocation failures during stub compilation. |
1049 if (failure_->IsFailure()) return failure_; | 1051 if (failure_->IsFailure()) return failure_; |
1050 | 1052 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 return GetCodeWithFlags(flags, name); | 1119 return GetCodeWithFlags(flags, name); |
1118 } | 1120 } |
1119 | 1121 |
1120 | 1122 |
1121 Object* ConstructStubCompiler::GetCode() { | 1123 Object* ConstructStubCompiler::GetCode() { |
1122 Code::Flags flags = Code::ComputeFlags(Code::STUB); | 1124 Code::Flags flags = Code::ComputeFlags(Code::STUB); |
1123 Object* result = GetCodeWithFlags(flags, "ConstructStub"); | 1125 Object* result = GetCodeWithFlags(flags, "ConstructStub"); |
1124 if (!result->IsFailure()) { | 1126 if (!result->IsFailure()) { |
1125 Code* code = Code::cast(result); | 1127 Code* code = Code::cast(result); |
1126 USE(code); | 1128 USE(code); |
1127 LOG(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); | 1129 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); |
1128 } | 1130 } |
1129 return result; | 1131 return result; |
1130 } | 1132 } |
1131 | 1133 |
1132 | 1134 |
1133 } } // namespace v8::internal | 1135 } } // namespace v8::internal |
OLD | NEW |