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 11 matching lines...) Expand all Loading... |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "api.h" | 30 #include "api.h" |
31 #include "arguments.h" | 31 #include "arguments.h" |
| 32 #include "gdbjit.h" |
32 #include "ic-inl.h" | 33 #include "ic-inl.h" |
33 #include "stub-cache.h" | 34 #include "stub-cache.h" |
34 #include "vm-state-inl.h" | 35 #include "vm-state-inl.h" |
35 | 36 |
36 namespace v8 { | 37 namespace v8 { |
37 namespace internal { | 38 namespace internal { |
38 | 39 |
39 // ----------------------------------------------------------------------- | 40 // ----------------------------------------------------------------------- |
40 // StubCache implementation. | 41 // StubCache implementation. |
41 | 42 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 Code::Flags flags = | 116 Code::Flags flags = |
116 Code::ComputeMonomorphicFlags(Code::LOAD_IC, NONEXISTENT); | 117 Code::ComputeMonomorphicFlags(Code::LOAD_IC, NONEXISTENT); |
117 Object* code = receiver->map()->FindInCodeCache(cache_name, flags); | 118 Object* code = receiver->map()->FindInCodeCache(cache_name, flags); |
118 if (code->IsUndefined()) { | 119 if (code->IsUndefined()) { |
119 LoadStubCompiler compiler; | 120 LoadStubCompiler compiler; |
120 { MaybeObject* maybe_code = | 121 { MaybeObject* maybe_code = |
121 compiler.CompileLoadNonexistent(cache_name, receiver, last); | 122 compiler.CompileLoadNonexistent(cache_name, receiver, last); |
122 if (!maybe_code->ToObject(&code)) return maybe_code; | 123 if (!maybe_code->ToObject(&code)) return maybe_code; |
123 } | 124 } |
124 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), cache_name)); | 125 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), cache_name)); |
| 126 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, cache_name, Code::cast(code))); |
125 Object* result; | 127 Object* result; |
126 { MaybeObject* maybe_result = | 128 { MaybeObject* maybe_result = |
127 receiver->UpdateMapCodeCache(cache_name, Code::cast(code)); | 129 receiver->UpdateMapCodeCache(cache_name, Code::cast(code)); |
128 if (!maybe_result->ToObject(&result)) return maybe_result; | 130 if (!maybe_result->ToObject(&result)) return maybe_result; |
129 } | 131 } |
130 } | 132 } |
131 return code; | 133 return code; |
132 } | 134 } |
133 | 135 |
134 | 136 |
135 MaybeObject* StubCache::ComputeLoadField(String* name, | 137 MaybeObject* StubCache::ComputeLoadField(String* name, |
136 JSObject* receiver, | 138 JSObject* receiver, |
137 JSObject* holder, | 139 JSObject* holder, |
138 int field_index) { | 140 int field_index) { |
139 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 141 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
140 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD); | 142 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD); |
141 Object* code = receiver->map()->FindInCodeCache(name, flags); | 143 Object* code = receiver->map()->FindInCodeCache(name, flags); |
142 if (code->IsUndefined()) { | 144 if (code->IsUndefined()) { |
143 LoadStubCompiler compiler; | 145 LoadStubCompiler compiler; |
144 { MaybeObject* maybe_code = | 146 { MaybeObject* maybe_code = |
145 compiler.CompileLoadField(receiver, holder, field_index, name); | 147 compiler.CompileLoadField(receiver, holder, field_index, name); |
146 if (!maybe_code->ToObject(&code)) return maybe_code; | 148 if (!maybe_code->ToObject(&code)) return maybe_code; |
147 } | 149 } |
148 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 150 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
| 151 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code))); |
149 Object* result; | 152 Object* result; |
150 { MaybeObject* maybe_result = | 153 { MaybeObject* maybe_result = |
151 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 154 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
152 if (!maybe_result->ToObject(&result)) return maybe_result; | 155 if (!maybe_result->ToObject(&result)) return maybe_result; |
153 } | 156 } |
154 } | 157 } |
155 return code; | 158 return code; |
156 } | 159 } |
157 | 160 |
158 | 161 |
159 MaybeObject* StubCache::ComputeLoadCallback(String* name, | 162 MaybeObject* StubCache::ComputeLoadCallback(String* name, |
160 JSObject* receiver, | 163 JSObject* receiver, |
161 JSObject* holder, | 164 JSObject* holder, |
162 AccessorInfo* callback) { | 165 AccessorInfo* callback) { |
163 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); | 166 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); |
164 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 167 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
165 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, CALLBACKS); | 168 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, CALLBACKS); |
166 Object* code = receiver->map()->FindInCodeCache(name, flags); | 169 Object* code = receiver->map()->FindInCodeCache(name, flags); |
167 if (code->IsUndefined()) { | 170 if (code->IsUndefined()) { |
168 LoadStubCompiler compiler; | 171 LoadStubCompiler compiler; |
169 { MaybeObject* maybe_code = | 172 { MaybeObject* maybe_code = |
170 compiler.CompileLoadCallback(name, receiver, holder, callback); | 173 compiler.CompileLoadCallback(name, receiver, holder, callback); |
171 if (!maybe_code->ToObject(&code)) return maybe_code; | 174 if (!maybe_code->ToObject(&code)) return maybe_code; |
172 } | 175 } |
173 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 176 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
| 177 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code))); |
174 Object* result; | 178 Object* result; |
175 { MaybeObject* maybe_result = | 179 { MaybeObject* maybe_result = |
176 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 180 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
177 if (!maybe_result->ToObject(&result)) return maybe_result; | 181 if (!maybe_result->ToObject(&result)) return maybe_result; |
178 } | 182 } |
179 } | 183 } |
180 return code; | 184 return code; |
181 } | 185 } |
182 | 186 |
183 | 187 |
184 MaybeObject* StubCache::ComputeLoadConstant(String* name, | 188 MaybeObject* StubCache::ComputeLoadConstant(String* name, |
185 JSObject* receiver, | 189 JSObject* receiver, |
186 JSObject* holder, | 190 JSObject* holder, |
187 Object* value) { | 191 Object* value) { |
188 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 192 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
189 Code::Flags flags = | 193 Code::Flags flags = |
190 Code::ComputeMonomorphicFlags(Code::LOAD_IC, CONSTANT_FUNCTION); | 194 Code::ComputeMonomorphicFlags(Code::LOAD_IC, CONSTANT_FUNCTION); |
191 Object* code = receiver->map()->FindInCodeCache(name, flags); | 195 Object* code = receiver->map()->FindInCodeCache(name, flags); |
192 if (code->IsUndefined()) { | 196 if (code->IsUndefined()) { |
193 LoadStubCompiler compiler; | 197 LoadStubCompiler compiler; |
194 { MaybeObject* maybe_code = | 198 { MaybeObject* maybe_code = |
195 compiler.CompileLoadConstant(receiver, holder, value, name); | 199 compiler.CompileLoadConstant(receiver, holder, value, name); |
196 if (!maybe_code->ToObject(&code)) return maybe_code; | 200 if (!maybe_code->ToObject(&code)) return maybe_code; |
197 } | 201 } |
198 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 202 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
| 203 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code))); |
199 Object* result; | 204 Object* result; |
200 { MaybeObject* maybe_result = | 205 { MaybeObject* maybe_result = |
201 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 206 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
202 if (!maybe_result->ToObject(&result)) return maybe_result; | 207 if (!maybe_result->ToObject(&result)) return maybe_result; |
203 } | 208 } |
204 } | 209 } |
205 return code; | 210 return code; |
206 } | 211 } |
207 | 212 |
208 | 213 |
209 MaybeObject* StubCache::ComputeLoadInterceptor(String* name, | 214 MaybeObject* StubCache::ComputeLoadInterceptor(String* name, |
210 JSObject* receiver, | 215 JSObject* receiver, |
211 JSObject* holder) { | 216 JSObject* holder) { |
212 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 217 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
213 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, INTERCEPTOR); | 218 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, INTERCEPTOR); |
214 Object* code = receiver->map()->FindInCodeCache(name, flags); | 219 Object* code = receiver->map()->FindInCodeCache(name, flags); |
215 if (code->IsUndefined()) { | 220 if (code->IsUndefined()) { |
216 LoadStubCompiler compiler; | 221 LoadStubCompiler compiler; |
217 { MaybeObject* maybe_code = | 222 { MaybeObject* maybe_code = |
218 compiler.CompileLoadInterceptor(receiver, holder, name); | 223 compiler.CompileLoadInterceptor(receiver, holder, name); |
219 if (!maybe_code->ToObject(&code)) return maybe_code; | 224 if (!maybe_code->ToObject(&code)) return maybe_code; |
220 } | 225 } |
221 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 226 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
| 227 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code))); |
222 Object* result; | 228 Object* result; |
223 { MaybeObject* maybe_result = | 229 { MaybeObject* maybe_result = |
224 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 230 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
225 if (!maybe_result->ToObject(&result)) return maybe_result; | 231 if (!maybe_result->ToObject(&result)) return maybe_result; |
226 } | 232 } |
227 } | 233 } |
228 return code; | 234 return code; |
229 } | 235 } |
230 | 236 |
231 | 237 |
(...skipping 13 matching lines...) Expand all Loading... |
245 if (code->IsUndefined()) { | 251 if (code->IsUndefined()) { |
246 LoadStubCompiler compiler; | 252 LoadStubCompiler compiler; |
247 { MaybeObject* maybe_code = compiler.CompileLoadGlobal(receiver, | 253 { MaybeObject* maybe_code = compiler.CompileLoadGlobal(receiver, |
248 holder, | 254 holder, |
249 cell, | 255 cell, |
250 name, | 256 name, |
251 is_dont_delete); | 257 is_dont_delete); |
252 if (!maybe_code->ToObject(&code)) return maybe_code; | 258 if (!maybe_code->ToObject(&code)) return maybe_code; |
253 } | 259 } |
254 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 260 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
| 261 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code))); |
255 Object* result; | 262 Object* result; |
256 { MaybeObject* maybe_result = | 263 { MaybeObject* maybe_result = |
257 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 264 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
258 if (!maybe_result->ToObject(&result)) return maybe_result; | 265 if (!maybe_result->ToObject(&result)) return maybe_result; |
259 } | 266 } |
260 } | 267 } |
261 return code; | 268 return code; |
262 } | 269 } |
263 | 270 |
264 | 271 |
265 MaybeObject* StubCache::ComputeKeyedLoadField(String* name, | 272 MaybeObject* StubCache::ComputeKeyedLoadField(String* name, |
266 JSObject* receiver, | 273 JSObject* receiver, |
267 JSObject* holder, | 274 JSObject* holder, |
268 int field_index) { | 275 int field_index) { |
269 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 276 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
270 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, FIELD); | 277 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, FIELD); |
271 Object* code = receiver->map()->FindInCodeCache(name, flags); | 278 Object* code = receiver->map()->FindInCodeCache(name, flags); |
272 if (code->IsUndefined()) { | 279 if (code->IsUndefined()) { |
273 KeyedLoadStubCompiler compiler; | 280 KeyedLoadStubCompiler compiler; |
274 { MaybeObject* maybe_code = | 281 { MaybeObject* maybe_code = |
275 compiler.CompileLoadField(name, receiver, holder, field_index); | 282 compiler.CompileLoadField(name, receiver, holder, field_index); |
276 if (!maybe_code->ToObject(&code)) return maybe_code; | 283 if (!maybe_code->ToObject(&code)) return maybe_code; |
277 } | 284 } |
278 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 285 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
| 286 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
279 Object* result; | 287 Object* result; |
280 { MaybeObject* maybe_result = | 288 { MaybeObject* maybe_result = |
281 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 289 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
282 if (!maybe_result->ToObject(&result)) return maybe_result; | 290 if (!maybe_result->ToObject(&result)) return maybe_result; |
283 } | 291 } |
284 } | 292 } |
285 return code; | 293 return code; |
286 } | 294 } |
287 | 295 |
288 | 296 |
289 MaybeObject* StubCache::ComputeKeyedLoadConstant(String* name, | 297 MaybeObject* StubCache::ComputeKeyedLoadConstant(String* name, |
290 JSObject* receiver, | 298 JSObject* receiver, |
291 JSObject* holder, | 299 JSObject* holder, |
292 Object* value) { | 300 Object* value) { |
293 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 301 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
294 Code::Flags flags = | 302 Code::Flags flags = |
295 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CONSTANT_FUNCTION); | 303 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CONSTANT_FUNCTION); |
296 Object* code = receiver->map()->FindInCodeCache(name, flags); | 304 Object* code = receiver->map()->FindInCodeCache(name, flags); |
297 if (code->IsUndefined()) { | 305 if (code->IsUndefined()) { |
298 KeyedLoadStubCompiler compiler; | 306 KeyedLoadStubCompiler compiler; |
299 { MaybeObject* maybe_code = | 307 { MaybeObject* maybe_code = |
300 compiler.CompileLoadConstant(name, receiver, holder, value); | 308 compiler.CompileLoadConstant(name, receiver, holder, value); |
301 if (!maybe_code->ToObject(&code)) return maybe_code; | 309 if (!maybe_code->ToObject(&code)) return maybe_code; |
302 } | 310 } |
303 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 311 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
| 312 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
304 Object* result; | 313 Object* result; |
305 { MaybeObject* maybe_result = | 314 { MaybeObject* maybe_result = |
306 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 315 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
307 if (!maybe_result->ToObject(&result)) return maybe_result; | 316 if (!maybe_result->ToObject(&result)) return maybe_result; |
308 } | 317 } |
309 } | 318 } |
310 return code; | 319 return code; |
311 } | 320 } |
312 | 321 |
313 | 322 |
314 MaybeObject* StubCache::ComputeKeyedLoadInterceptor(String* name, | 323 MaybeObject* StubCache::ComputeKeyedLoadInterceptor(String* name, |
315 JSObject* receiver, | 324 JSObject* receiver, |
316 JSObject* holder) { | 325 JSObject* holder) { |
317 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 326 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
318 Code::Flags flags = | 327 Code::Flags flags = |
319 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, INTERCEPTOR); | 328 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, INTERCEPTOR); |
320 Object* code = receiver->map()->FindInCodeCache(name, flags); | 329 Object* code = receiver->map()->FindInCodeCache(name, flags); |
321 if (code->IsUndefined()) { | 330 if (code->IsUndefined()) { |
322 KeyedLoadStubCompiler compiler; | 331 KeyedLoadStubCompiler compiler; |
323 { MaybeObject* maybe_code = | 332 { MaybeObject* maybe_code = |
324 compiler.CompileLoadInterceptor(receiver, holder, name); | 333 compiler.CompileLoadInterceptor(receiver, holder, name); |
325 if (!maybe_code->ToObject(&code)) return maybe_code; | 334 if (!maybe_code->ToObject(&code)) return maybe_code; |
326 } | 335 } |
327 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 336 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
| 337 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
328 Object* result; | 338 Object* result; |
329 { MaybeObject* maybe_result = | 339 { MaybeObject* maybe_result = |
330 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 340 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
331 if (!maybe_result->ToObject(&result)) return maybe_result; | 341 if (!maybe_result->ToObject(&result)) return maybe_result; |
332 } | 342 } |
333 } | 343 } |
334 return code; | 344 return code; |
335 } | 345 } |
336 | 346 |
337 | 347 |
338 MaybeObject* StubCache::ComputeKeyedLoadCallback(String* name, | 348 MaybeObject* StubCache::ComputeKeyedLoadCallback(String* name, |
339 JSObject* receiver, | 349 JSObject* receiver, |
340 JSObject* holder, | 350 JSObject* holder, |
341 AccessorInfo* callback) { | 351 AccessorInfo* callback) { |
342 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 352 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
343 Code::Flags flags = | 353 Code::Flags flags = |
344 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 354 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
345 Object* code = receiver->map()->FindInCodeCache(name, flags); | 355 Object* code = receiver->map()->FindInCodeCache(name, flags); |
346 if (code->IsUndefined()) { | 356 if (code->IsUndefined()) { |
347 KeyedLoadStubCompiler compiler; | 357 KeyedLoadStubCompiler compiler; |
348 { MaybeObject* maybe_code = | 358 { MaybeObject* maybe_code = |
349 compiler.CompileLoadCallback(name, receiver, holder, callback); | 359 compiler.CompileLoadCallback(name, receiver, holder, callback); |
350 if (!maybe_code->ToObject(&code)) return maybe_code; | 360 if (!maybe_code->ToObject(&code)) return maybe_code; |
351 } | 361 } |
352 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 362 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
| 363 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
353 Object* result; | 364 Object* result; |
354 { MaybeObject* maybe_result = | 365 { MaybeObject* maybe_result = |
355 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 366 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
356 if (!maybe_result->ToObject(&result)) return maybe_result; | 367 if (!maybe_result->ToObject(&result)) return maybe_result; |
357 } | 368 } |
358 } | 369 } |
359 return code; | 370 return code; |
360 } | 371 } |
361 | 372 |
362 | 373 |
363 | 374 |
364 MaybeObject* StubCache::ComputeKeyedLoadArrayLength(String* name, | 375 MaybeObject* StubCache::ComputeKeyedLoadArrayLength(String* name, |
365 JSArray* receiver) { | 376 JSArray* receiver) { |
366 Code::Flags flags = | 377 Code::Flags flags = |
367 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 378 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
368 ASSERT(receiver->IsJSObject()); | 379 ASSERT(receiver->IsJSObject()); |
369 Object* code = receiver->map()->FindInCodeCache(name, flags); | 380 Object* code = receiver->map()->FindInCodeCache(name, flags); |
370 if (code->IsUndefined()) { | 381 if (code->IsUndefined()) { |
371 KeyedLoadStubCompiler compiler; | 382 KeyedLoadStubCompiler compiler; |
372 { MaybeObject* maybe_code = compiler.CompileLoadArrayLength(name); | 383 { MaybeObject* maybe_code = compiler.CompileLoadArrayLength(name); |
373 if (!maybe_code->ToObject(&code)) return maybe_code; | 384 if (!maybe_code->ToObject(&code)) return maybe_code; |
374 } | 385 } |
375 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 386 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
| 387 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
376 Object* result; | 388 Object* result; |
377 { MaybeObject* maybe_result = | 389 { MaybeObject* maybe_result = |
378 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 390 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
379 if (!maybe_result->ToObject(&result)) return maybe_result; | 391 if (!maybe_result->ToObject(&result)) return maybe_result; |
380 } | 392 } |
381 } | 393 } |
382 return code; | 394 return code; |
383 } | 395 } |
384 | 396 |
385 | 397 |
386 MaybeObject* StubCache::ComputeKeyedLoadStringLength(String* name, | 398 MaybeObject* StubCache::ComputeKeyedLoadStringLength(String* name, |
387 String* receiver) { | 399 String* receiver) { |
388 Code::Flags flags = | 400 Code::Flags flags = |
389 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 401 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
390 Map* map = receiver->map(); | 402 Map* map = receiver->map(); |
391 Object* code = map->FindInCodeCache(name, flags); | 403 Object* code = map->FindInCodeCache(name, flags); |
392 if (code->IsUndefined()) { | 404 if (code->IsUndefined()) { |
393 KeyedLoadStubCompiler compiler; | 405 KeyedLoadStubCompiler compiler; |
394 { MaybeObject* maybe_code = compiler.CompileLoadStringLength(name); | 406 { MaybeObject* maybe_code = compiler.CompileLoadStringLength(name); |
395 if (!maybe_code->ToObject(&code)) return maybe_code; | 407 if (!maybe_code->ToObject(&code)) return maybe_code; |
396 } | 408 } |
397 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 409 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
| 410 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
398 Object* result; | 411 Object* result; |
399 { MaybeObject* maybe_result = map->UpdateCodeCache(name, Code::cast(code)); | 412 { MaybeObject* maybe_result = map->UpdateCodeCache(name, Code::cast(code)); |
400 if (!maybe_result->ToObject(&result)) return maybe_result; | 413 if (!maybe_result->ToObject(&result)) return maybe_result; |
401 } | 414 } |
402 } | 415 } |
403 return code; | 416 return code; |
404 } | 417 } |
405 | 418 |
406 | 419 |
407 MaybeObject* StubCache::ComputeKeyedLoadFunctionPrototype( | 420 MaybeObject* StubCache::ComputeKeyedLoadFunctionPrototype( |
408 String* name, | 421 String* name, |
409 JSFunction* receiver) { | 422 JSFunction* receiver) { |
410 Code::Flags flags = | 423 Code::Flags flags = |
411 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 424 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
412 Object* code = receiver->map()->FindInCodeCache(name, flags); | 425 Object* code = receiver->map()->FindInCodeCache(name, flags); |
413 if (code->IsUndefined()) { | 426 if (code->IsUndefined()) { |
414 KeyedLoadStubCompiler compiler; | 427 KeyedLoadStubCompiler compiler; |
415 { MaybeObject* maybe_code = compiler.CompileLoadFunctionPrototype(name); | 428 { MaybeObject* maybe_code = compiler.CompileLoadFunctionPrototype(name); |
416 if (!maybe_code->ToObject(&code)) return maybe_code; | 429 if (!maybe_code->ToObject(&code)) return maybe_code; |
417 } | 430 } |
418 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 431 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
| 432 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
419 Object* result; | 433 Object* result; |
420 { MaybeObject* maybe_result = | 434 { MaybeObject* maybe_result = |
421 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 435 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
422 if (!maybe_result->ToObject(&result)) return maybe_result; | 436 if (!maybe_result->ToObject(&result)) return maybe_result; |
423 } | 437 } |
424 } | 438 } |
425 return code; | 439 return code; |
426 } | 440 } |
427 | 441 |
428 | 442 |
(...skipping 25 matching lines...) Expand all Loading... |
454 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; | 468 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; |
455 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); | 469 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); |
456 Object* code = receiver->map()->FindInCodeCache(name, flags); | 470 Object* code = receiver->map()->FindInCodeCache(name, flags); |
457 if (code->IsUndefined()) { | 471 if (code->IsUndefined()) { |
458 StoreStubCompiler compiler; | 472 StoreStubCompiler compiler; |
459 { MaybeObject* maybe_code = | 473 { MaybeObject* maybe_code = |
460 compiler.CompileStoreField(receiver, field_index, transition, name); | 474 compiler.CompileStoreField(receiver, field_index, transition, name); |
461 if (!maybe_code->ToObject(&code)) return maybe_code; | 475 if (!maybe_code->ToObject(&code)) return maybe_code; |
462 } | 476 } |
463 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 477 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
| 478 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
464 Object* result; | 479 Object* result; |
465 { MaybeObject* maybe_result = | 480 { MaybeObject* maybe_result = |
466 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 481 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
467 if (!maybe_result->ToObject(&result)) return maybe_result; | 482 if (!maybe_result->ToObject(&result)) return maybe_result; |
468 } | 483 } |
469 } | 484 } |
470 return code; | 485 return code; |
471 } | 486 } |
472 | 487 |
473 | 488 |
(...skipping 28 matching lines...) Expand all Loading... |
502 JSGlobalPropertyCell* cell) { | 517 JSGlobalPropertyCell* cell) { |
503 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); | 518 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); |
504 Object* code = receiver->map()->FindInCodeCache(name, flags); | 519 Object* code = receiver->map()->FindInCodeCache(name, flags); |
505 if (code->IsUndefined()) { | 520 if (code->IsUndefined()) { |
506 StoreStubCompiler compiler; | 521 StoreStubCompiler compiler; |
507 { MaybeObject* maybe_code = | 522 { MaybeObject* maybe_code = |
508 compiler.CompileStoreGlobal(receiver, cell, name); | 523 compiler.CompileStoreGlobal(receiver, cell, name); |
509 if (!maybe_code->ToObject(&code)) return maybe_code; | 524 if (!maybe_code->ToObject(&code)) return maybe_code; |
510 } | 525 } |
511 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 526 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
| 527 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
512 Object* result; | 528 Object* result; |
513 { MaybeObject* maybe_result = | 529 { MaybeObject* maybe_result = |
514 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 530 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
515 if (!maybe_result->ToObject(&result)) return maybe_result; | 531 if (!maybe_result->ToObject(&result)) return maybe_result; |
516 } | 532 } |
517 } | 533 } |
518 return code; | 534 return code; |
519 } | 535 } |
520 | 536 |
521 | 537 |
522 MaybeObject* StubCache::ComputeStoreCallback(String* name, | 538 MaybeObject* StubCache::ComputeStoreCallback(String* name, |
523 JSObject* receiver, | 539 JSObject* receiver, |
524 AccessorInfo* callback) { | 540 AccessorInfo* callback) { |
525 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); | 541 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); |
526 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, CALLBACKS); | 542 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, CALLBACKS); |
527 Object* code = receiver->map()->FindInCodeCache(name, flags); | 543 Object* code = receiver->map()->FindInCodeCache(name, flags); |
528 if (code->IsUndefined()) { | 544 if (code->IsUndefined()) { |
529 StoreStubCompiler compiler; | 545 StoreStubCompiler compiler; |
530 { MaybeObject* maybe_code = | 546 { MaybeObject* maybe_code = |
531 compiler.CompileStoreCallback(receiver, callback, name); | 547 compiler.CompileStoreCallback(receiver, callback, name); |
532 if (!maybe_code->ToObject(&code)) return maybe_code; | 548 if (!maybe_code->ToObject(&code)) return maybe_code; |
533 } | 549 } |
534 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 550 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
| 551 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
535 Object* result; | 552 Object* result; |
536 { MaybeObject* maybe_result = | 553 { MaybeObject* maybe_result = |
537 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 554 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
538 if (!maybe_result->ToObject(&result)) return maybe_result; | 555 if (!maybe_result->ToObject(&result)) return maybe_result; |
539 } | 556 } |
540 } | 557 } |
541 return code; | 558 return code; |
542 } | 559 } |
543 | 560 |
544 | 561 |
545 MaybeObject* StubCache::ComputeStoreInterceptor(String* name, | 562 MaybeObject* StubCache::ComputeStoreInterceptor(String* name, |
546 JSObject* receiver) { | 563 JSObject* receiver) { |
547 Code::Flags flags = | 564 Code::Flags flags = |
548 Code::ComputeMonomorphicFlags(Code::STORE_IC, INTERCEPTOR); | 565 Code::ComputeMonomorphicFlags(Code::STORE_IC, INTERCEPTOR); |
549 Object* code = receiver->map()->FindInCodeCache(name, flags); | 566 Object* code = receiver->map()->FindInCodeCache(name, flags); |
550 if (code->IsUndefined()) { | 567 if (code->IsUndefined()) { |
551 StoreStubCompiler compiler; | 568 StoreStubCompiler compiler; |
552 { MaybeObject* maybe_code = | 569 { MaybeObject* maybe_code = |
553 compiler.CompileStoreInterceptor(receiver, name); | 570 compiler.CompileStoreInterceptor(receiver, name); |
554 if (!maybe_code->ToObject(&code)) return maybe_code; | 571 if (!maybe_code->ToObject(&code)) return maybe_code; |
555 } | 572 } |
556 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 573 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
| 574 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
557 Object* result; | 575 Object* result; |
558 { MaybeObject* maybe_result = | 576 { MaybeObject* maybe_result = |
559 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 577 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
560 if (!maybe_result->ToObject(&result)) return maybe_result; | 578 if (!maybe_result->ToObject(&result)) return maybe_result; |
561 } | 579 } |
562 } | 580 } |
563 return code; | 581 return code; |
564 } | 582 } |
565 | 583 |
566 | 584 |
567 MaybeObject* StubCache::ComputeKeyedStoreField(String* name, | 585 MaybeObject* StubCache::ComputeKeyedStoreField(String* name, |
568 JSObject* receiver, | 586 JSObject* receiver, |
569 int field_index, | 587 int field_index, |
570 Map* transition) { | 588 Map* transition) { |
571 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; | 589 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; |
572 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); | 590 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); |
573 Object* code = receiver->map()->FindInCodeCache(name, flags); | 591 Object* code = receiver->map()->FindInCodeCache(name, flags); |
574 if (code->IsUndefined()) { | 592 if (code->IsUndefined()) { |
575 KeyedStoreStubCompiler compiler; | 593 KeyedStoreStubCompiler compiler; |
576 { MaybeObject* maybe_code = | 594 { MaybeObject* maybe_code = |
577 compiler.CompileStoreField(receiver, field_index, transition, name); | 595 compiler.CompileStoreField(receiver, field_index, transition, name); |
578 if (!maybe_code->ToObject(&code)) return maybe_code; | 596 if (!maybe_code->ToObject(&code)) return maybe_code; |
579 } | 597 } |
580 PROFILE(CodeCreateEvent( | 598 PROFILE(CodeCreateEvent( |
581 Logger::KEYED_STORE_IC_TAG, Code::cast(code), name)); | 599 Logger::KEYED_STORE_IC_TAG, Code::cast(code), name)); |
| 600 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code))); |
582 Object* result; | 601 Object* result; |
583 { MaybeObject* maybe_result = | 602 { MaybeObject* maybe_result = |
584 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 603 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
585 if (!maybe_result->ToObject(&result)) return maybe_result; | 604 if (!maybe_result->ToObject(&result)) return maybe_result; |
586 } | 605 } |
587 } | 606 } |
588 return code; | 607 return code; |
589 } | 608 } |
590 | 609 |
591 #define CALL_LOGGER_TAG(kind, type) \ | 610 #define CALL_LOGGER_TAG(kind, type) \ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 // Compile the stub - only create stubs for fully compiled functions. | 648 // Compile the stub - only create stubs for fully compiled functions. |
630 CallStubCompiler compiler(argc, in_loop, kind, cache_holder); | 649 CallStubCompiler compiler(argc, in_loop, kind, cache_holder); |
631 { MaybeObject* maybe_code = | 650 { MaybeObject* maybe_code = |
632 compiler.CompileCallConstant(object, holder, function, name, check); | 651 compiler.CompileCallConstant(object, holder, function, name, check); |
633 if (!maybe_code->ToObject(&code)) return maybe_code; | 652 if (!maybe_code->ToObject(&code)) return maybe_code; |
634 } | 653 } |
635 Code::cast(code)->set_check_type(check); | 654 Code::cast(code)->set_check_type(check); |
636 ASSERT_EQ(flags, Code::cast(code)->flags()); | 655 ASSERT_EQ(flags, Code::cast(code)->flags()); |
637 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), | 656 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), |
638 Code::cast(code), name)); | 657 Code::cast(code), name)); |
| 658 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); |
639 Object* result; | 659 Object* result; |
640 { MaybeObject* maybe_result = | 660 { MaybeObject* maybe_result = |
641 map_holder->UpdateMapCodeCache(name, Code::cast(code)); | 661 map_holder->UpdateMapCodeCache(name, Code::cast(code)); |
642 if (!maybe_result->ToObject(&result)) return maybe_result; | 662 if (!maybe_result->ToObject(&result)) return maybe_result; |
643 } | 663 } |
644 } | 664 } |
645 return code; | 665 return code; |
646 } | 666 } |
647 | 667 |
648 | 668 |
(...skipping 27 matching lines...) Expand all Loading... |
676 { MaybeObject* maybe_code = | 696 { MaybeObject* maybe_code = |
677 compiler.CompileCallField(JSObject::cast(object), | 697 compiler.CompileCallField(JSObject::cast(object), |
678 holder, | 698 holder, |
679 index, | 699 index, |
680 name); | 700 name); |
681 if (!maybe_code->ToObject(&code)) return maybe_code; | 701 if (!maybe_code->ToObject(&code)) return maybe_code; |
682 } | 702 } |
683 ASSERT_EQ(flags, Code::cast(code)->flags()); | 703 ASSERT_EQ(flags, Code::cast(code)->flags()); |
684 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), | 704 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), |
685 Code::cast(code), name)); | 705 Code::cast(code), name)); |
| 706 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); |
686 Object* result; | 707 Object* result; |
687 { MaybeObject* maybe_result = | 708 { MaybeObject* maybe_result = |
688 map_holder->UpdateMapCodeCache(name, Code::cast(code)); | 709 map_holder->UpdateMapCodeCache(name, Code::cast(code)); |
689 if (!maybe_result->ToObject(&result)) return maybe_result; | 710 if (!maybe_result->ToObject(&result)) return maybe_result; |
690 } | 711 } |
691 } | 712 } |
692 return code; | 713 return code; |
693 } | 714 } |
694 | 715 |
695 | 716 |
(...skipping 23 matching lines...) Expand all Loading... |
719 Object* code = map_holder->map()->FindInCodeCache(name, flags); | 740 Object* code = map_holder->map()->FindInCodeCache(name, flags); |
720 if (code->IsUndefined()) { | 741 if (code->IsUndefined()) { |
721 CallStubCompiler compiler(argc, NOT_IN_LOOP, kind, cache_holder); | 742 CallStubCompiler compiler(argc, NOT_IN_LOOP, kind, cache_holder); |
722 { MaybeObject* maybe_code = | 743 { MaybeObject* maybe_code = |
723 compiler.CompileCallInterceptor(JSObject::cast(object), holder, name); | 744 compiler.CompileCallInterceptor(JSObject::cast(object), holder, name); |
724 if (!maybe_code->ToObject(&code)) return maybe_code; | 745 if (!maybe_code->ToObject(&code)) return maybe_code; |
725 } | 746 } |
726 ASSERT_EQ(flags, Code::cast(code)->flags()); | 747 ASSERT_EQ(flags, Code::cast(code)->flags()); |
727 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), | 748 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), |
728 Code::cast(code), name)); | 749 Code::cast(code), name)); |
| 750 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); |
729 Object* result; | 751 Object* result; |
730 { MaybeObject* maybe_result = | 752 { MaybeObject* maybe_result = |
731 map_holder->UpdateMapCodeCache(name, Code::cast(code)); | 753 map_holder->UpdateMapCodeCache(name, Code::cast(code)); |
732 if (!maybe_result->ToObject(&result)) return maybe_result; | 754 if (!maybe_result->ToObject(&result)) return maybe_result; |
733 } | 755 } |
734 } | 756 } |
735 return code; | 757 return code; |
736 } | 758 } |
737 | 759 |
738 | 760 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 // caches. | 796 // caches. |
775 if (!function->is_compiled()) return Failure::InternalError(); | 797 if (!function->is_compiled()) return Failure::InternalError(); |
776 CallStubCompiler compiler(argc, in_loop, kind, cache_holder); | 798 CallStubCompiler compiler(argc, in_loop, kind, cache_holder); |
777 { MaybeObject* maybe_code = | 799 { MaybeObject* maybe_code = |
778 compiler.CompileCallGlobal(receiver, holder, cell, function, name); | 800 compiler.CompileCallGlobal(receiver, holder, cell, function, name); |
779 if (!maybe_code->ToObject(&code)) return maybe_code; | 801 if (!maybe_code->ToObject(&code)) return maybe_code; |
780 } | 802 } |
781 ASSERT_EQ(flags, Code::cast(code)->flags()); | 803 ASSERT_EQ(flags, Code::cast(code)->flags()); |
782 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), | 804 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), |
783 Code::cast(code), name)); | 805 Code::cast(code), name)); |
| 806 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); |
784 Object* result; | 807 Object* result; |
785 { MaybeObject* maybe_result = | 808 { MaybeObject* maybe_result = |
786 map_holder->UpdateMapCodeCache(name, Code::cast(code)); | 809 map_holder->UpdateMapCodeCache(name, Code::cast(code)); |
787 if (!maybe_result->ToObject(&result)) return maybe_result; | 810 if (!maybe_result->ToObject(&result)) return maybe_result; |
788 } | 811 } |
789 } | 812 } |
790 return code; | 813 return code; |
791 } | 814 } |
792 | 815 |
793 | 816 |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 Object* result; | 1273 Object* result; |
1251 { MaybeObject* maybe_result = | 1274 { MaybeObject* maybe_result = |
1252 GetCodeWithFlags(flags, "CompileCallInitialize"); | 1275 GetCodeWithFlags(flags, "CompileCallInitialize"); |
1253 if (!maybe_result->ToObject(&result)) return maybe_result; | 1276 if (!maybe_result->ToObject(&result)) return maybe_result; |
1254 } | 1277 } |
1255 Counters::call_initialize_stubs.Increment(); | 1278 Counters::call_initialize_stubs.Increment(); |
1256 Code* code = Code::cast(result); | 1279 Code* code = Code::cast(result); |
1257 USE(code); | 1280 USE(code); |
1258 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_INITIALIZE_TAG), | 1281 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_INITIALIZE_TAG), |
1259 code, code->arguments_count())); | 1282 code, code->arguments_count())); |
| 1283 GDBJIT(AddCode(GDBJITInterface::CALL_INITIALIZE, Code::cast(code))); |
1260 return result; | 1284 return result; |
1261 } | 1285 } |
1262 | 1286 |
1263 | 1287 |
1264 MaybeObject* StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) { | 1288 MaybeObject* StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) { |
1265 HandleScope scope; | 1289 HandleScope scope; |
1266 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1290 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1267 // The code of the PreMonomorphic stub is the same as the code | 1291 // The code of the PreMonomorphic stub is the same as the code |
1268 // of the Initialized stub. They just differ on the code object flags. | 1292 // of the Initialized stub. They just differ on the code object flags. |
1269 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1293 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1270 if (kind == Code::CALL_IC) { | 1294 if (kind == Code::CALL_IC) { |
1271 CallIC::GenerateInitialize(masm(), argc); | 1295 CallIC::GenerateInitialize(masm(), argc); |
1272 } else { | 1296 } else { |
1273 KeyedCallIC::GenerateInitialize(masm(), argc); | 1297 KeyedCallIC::GenerateInitialize(masm(), argc); |
1274 } | 1298 } |
1275 Object* result; | 1299 Object* result; |
1276 { MaybeObject* maybe_result = | 1300 { MaybeObject* maybe_result = |
1277 GetCodeWithFlags(flags, "CompileCallPreMonomorphic"); | 1301 GetCodeWithFlags(flags, "CompileCallPreMonomorphic"); |
1278 if (!maybe_result->ToObject(&result)) return maybe_result; | 1302 if (!maybe_result->ToObject(&result)) return maybe_result; |
1279 } | 1303 } |
1280 Counters::call_premonomorphic_stubs.Increment(); | 1304 Counters::call_premonomorphic_stubs.Increment(); |
1281 Code* code = Code::cast(result); | 1305 Code* code = Code::cast(result); |
1282 USE(code); | 1306 USE(code); |
1283 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_PRE_MONOMORPHIC_TAG), | 1307 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_PRE_MONOMORPHIC_TAG), |
1284 code, code->arguments_count())); | 1308 code, code->arguments_count())); |
| 1309 GDBJIT(AddCode(GDBJITInterface::CALL_PRE_MONOMORPHIC, Code::cast(code))); |
1285 return result; | 1310 return result; |
1286 } | 1311 } |
1287 | 1312 |
1288 | 1313 |
1289 MaybeObject* StubCompiler::CompileCallNormal(Code::Flags flags) { | 1314 MaybeObject* StubCompiler::CompileCallNormal(Code::Flags flags) { |
1290 HandleScope scope; | 1315 HandleScope scope; |
1291 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1316 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1292 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1317 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1293 if (kind == Code::CALL_IC) { | 1318 if (kind == Code::CALL_IC) { |
1294 CallIC::GenerateNormal(masm(), argc); | 1319 CallIC::GenerateNormal(masm(), argc); |
1295 } else { | 1320 } else { |
1296 KeyedCallIC::GenerateNormal(masm(), argc); | 1321 KeyedCallIC::GenerateNormal(masm(), argc); |
1297 } | 1322 } |
1298 Object* result; | 1323 Object* result; |
1299 { MaybeObject* maybe_result = GetCodeWithFlags(flags, "CompileCallNormal"); | 1324 { MaybeObject* maybe_result = GetCodeWithFlags(flags, "CompileCallNormal"); |
1300 if (!maybe_result->ToObject(&result)) return maybe_result; | 1325 if (!maybe_result->ToObject(&result)) return maybe_result; |
1301 } | 1326 } |
1302 Counters::call_normal_stubs.Increment(); | 1327 Counters::call_normal_stubs.Increment(); |
1303 Code* code = Code::cast(result); | 1328 Code* code = Code::cast(result); |
1304 USE(code); | 1329 USE(code); |
1305 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_NORMAL_TAG), | 1330 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_NORMAL_TAG), |
1306 code, code->arguments_count())); | 1331 code, code->arguments_count())); |
| 1332 GDBJIT(AddCode(GDBJITInterface::CALL_NORMAL, Code::cast(code))); |
1307 return result; | 1333 return result; |
1308 } | 1334 } |
1309 | 1335 |
1310 | 1336 |
1311 MaybeObject* StubCompiler::CompileCallMegamorphic(Code::Flags flags) { | 1337 MaybeObject* StubCompiler::CompileCallMegamorphic(Code::Flags flags) { |
1312 HandleScope scope; | 1338 HandleScope scope; |
1313 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1339 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1314 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1340 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1315 if (kind == Code::CALL_IC) { | 1341 if (kind == Code::CALL_IC) { |
1316 CallIC::GenerateMegamorphic(masm(), argc); | 1342 CallIC::GenerateMegamorphic(masm(), argc); |
1317 } else { | 1343 } else { |
1318 KeyedCallIC::GenerateMegamorphic(masm(), argc); | 1344 KeyedCallIC::GenerateMegamorphic(masm(), argc); |
1319 } | 1345 } |
1320 | 1346 |
1321 Object* result; | 1347 Object* result; |
1322 { MaybeObject* maybe_result = | 1348 { MaybeObject* maybe_result = |
1323 GetCodeWithFlags(flags, "CompileCallMegamorphic"); | 1349 GetCodeWithFlags(flags, "CompileCallMegamorphic"); |
1324 if (!maybe_result->ToObject(&result)) return maybe_result; | 1350 if (!maybe_result->ToObject(&result)) return maybe_result; |
1325 } | 1351 } |
1326 Counters::call_megamorphic_stubs.Increment(); | 1352 Counters::call_megamorphic_stubs.Increment(); |
1327 Code* code = Code::cast(result); | 1353 Code* code = Code::cast(result); |
1328 USE(code); | 1354 USE(code); |
1329 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), | 1355 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), |
1330 code, code->arguments_count())); | 1356 code, code->arguments_count())); |
| 1357 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, Code::cast(code))); |
1331 return result; | 1358 return result; |
1332 } | 1359 } |
1333 | 1360 |
1334 | 1361 |
1335 MaybeObject* StubCompiler::CompileCallMiss(Code::Flags flags) { | 1362 MaybeObject* StubCompiler::CompileCallMiss(Code::Flags flags) { |
1336 HandleScope scope; | 1363 HandleScope scope; |
1337 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1364 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1338 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1365 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1339 if (kind == Code::CALL_IC) { | 1366 if (kind == Code::CALL_IC) { |
1340 CallIC::GenerateMiss(masm(), argc); | 1367 CallIC::GenerateMiss(masm(), argc); |
1341 } else { | 1368 } else { |
1342 KeyedCallIC::GenerateMiss(masm(), argc); | 1369 KeyedCallIC::GenerateMiss(masm(), argc); |
1343 } | 1370 } |
1344 Object* result; | 1371 Object* result; |
1345 { MaybeObject* maybe_result = GetCodeWithFlags(flags, "CompileCallMiss"); | 1372 { MaybeObject* maybe_result = GetCodeWithFlags(flags, "CompileCallMiss"); |
1346 if (!maybe_result->ToObject(&result)) return maybe_result; | 1373 if (!maybe_result->ToObject(&result)) return maybe_result; |
1347 } | 1374 } |
1348 Counters::call_megamorphic_stubs.Increment(); | 1375 Counters::call_megamorphic_stubs.Increment(); |
1349 Code* code = Code::cast(result); | 1376 Code* code = Code::cast(result); |
1350 USE(code); | 1377 USE(code); |
1351 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MISS_TAG), | 1378 PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MISS_TAG), |
1352 code, code->arguments_count())); | 1379 code, code->arguments_count())); |
| 1380 GDBJIT(AddCode(GDBJITInterface::CALL_MISS, Code::cast(code))); |
1353 return result; | 1381 return result; |
1354 } | 1382 } |
1355 | 1383 |
1356 | 1384 |
1357 #ifdef ENABLE_DEBUGGER_SUPPORT | 1385 #ifdef ENABLE_DEBUGGER_SUPPORT |
1358 MaybeObject* StubCompiler::CompileCallDebugBreak(Code::Flags flags) { | 1386 MaybeObject* StubCompiler::CompileCallDebugBreak(Code::Flags flags) { |
1359 HandleScope scope; | 1387 HandleScope scope; |
1360 Debug::GenerateCallICDebugBreak(masm()); | 1388 Debug::GenerateCallICDebugBreak(masm()); |
1361 Object* result; | 1389 Object* result; |
1362 { MaybeObject* maybe_result = | 1390 { MaybeObject* maybe_result = |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 | 1470 |
1443 | 1471 |
1444 | 1472 |
1445 MaybeObject* LoadStubCompiler::GetCode(PropertyType type, String* name) { | 1473 MaybeObject* LoadStubCompiler::GetCode(PropertyType type, String* name) { |
1446 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, type); | 1474 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, type); |
1447 MaybeObject* result = GetCodeWithFlags(flags, name); | 1475 MaybeObject* result = GetCodeWithFlags(flags, name); |
1448 if (!result->IsFailure()) { | 1476 if (!result->IsFailure()) { |
1449 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, | 1477 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, |
1450 Code::cast(result->ToObjectUnchecked()), | 1478 Code::cast(result->ToObjectUnchecked()), |
1451 name)); | 1479 name)); |
| 1480 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, |
| 1481 name, |
| 1482 Code::cast(result->ToObjectUnchecked()))); |
1452 } | 1483 } |
1453 return result; | 1484 return result; |
1454 } | 1485 } |
1455 | 1486 |
1456 | 1487 |
1457 MaybeObject* KeyedLoadStubCompiler::GetCode(PropertyType type, String* name) { | 1488 MaybeObject* KeyedLoadStubCompiler::GetCode(PropertyType type, String* name) { |
1458 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, type); | 1489 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, type); |
1459 MaybeObject* result = GetCodeWithFlags(flags, name); | 1490 MaybeObject* result = GetCodeWithFlags(flags, name); |
1460 if (!result->IsFailure()) { | 1491 if (!result->IsFailure()) { |
1461 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, | 1492 PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, |
1462 Code::cast(result->ToObjectUnchecked()), | 1493 Code::cast(result->ToObjectUnchecked()), |
1463 name)); | 1494 name)); |
| 1495 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, |
| 1496 name, |
| 1497 Code::cast(result->ToObjectUnchecked()))); |
1464 } | 1498 } |
1465 return result; | 1499 return result; |
1466 } | 1500 } |
1467 | 1501 |
1468 | 1502 |
1469 MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { | 1503 MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { |
1470 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); | 1504 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); |
1471 MaybeObject* result = GetCodeWithFlags(flags, name); | 1505 MaybeObject* result = GetCodeWithFlags(flags, name); |
1472 if (!result->IsFailure()) { | 1506 if (!result->IsFailure()) { |
1473 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, | 1507 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, |
1474 Code::cast(result->ToObjectUnchecked()), | 1508 Code::cast(result->ToObjectUnchecked()), |
1475 name)); | 1509 name)); |
| 1510 GDBJIT(AddCode(GDBJITInterface::STORE_IC, |
| 1511 name, |
| 1512 Code::cast(result->ToObjectUnchecked()))); |
1476 } | 1513 } |
1477 return result; | 1514 return result; |
1478 } | 1515 } |
1479 | 1516 |
1480 | 1517 |
1481 MaybeObject* KeyedStoreStubCompiler::GetCode(PropertyType type, String* name) { | 1518 MaybeObject* KeyedStoreStubCompiler::GetCode(PropertyType type, String* name) { |
1482 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); | 1519 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); |
1483 MaybeObject* result = GetCodeWithFlags(flags, name); | 1520 MaybeObject* result = GetCodeWithFlags(flags, name); |
1484 if (!result->IsFailure()) { | 1521 if (!result->IsFailure()) { |
1485 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, | 1522 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, |
1486 Code::cast(result->ToObjectUnchecked()), | 1523 Code::cast(result->ToObjectUnchecked()), |
1487 name)); | 1524 name)); |
| 1525 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, |
| 1526 name, |
| 1527 Code::cast(result->ToObjectUnchecked()))); |
1488 } | 1528 } |
1489 return result; | 1529 return result; |
1490 } | 1530 } |
1491 | 1531 |
1492 | 1532 |
1493 CallStubCompiler::CallStubCompiler(int argc, | 1533 CallStubCompiler::CallStubCompiler(int argc, |
1494 InLoopFlag in_loop, | 1534 InLoopFlag in_loop, |
1495 Code::Kind kind, | 1535 Code::Kind kind, |
1496 InlineCacheHolderFlag cache_holder) | 1536 InlineCacheHolderFlag cache_holder) |
1497 : arguments_(argc) | 1537 : arguments_(argc) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 | 1592 |
1553 MaybeObject* ConstructStubCompiler::GetCode() { | 1593 MaybeObject* ConstructStubCompiler::GetCode() { |
1554 Code::Flags flags = Code::ComputeFlags(Code::STUB); | 1594 Code::Flags flags = Code::ComputeFlags(Code::STUB); |
1555 Object* result; | 1595 Object* result; |
1556 { MaybeObject* maybe_result = GetCodeWithFlags(flags, "ConstructStub"); | 1596 { MaybeObject* maybe_result = GetCodeWithFlags(flags, "ConstructStub"); |
1557 if (!maybe_result->ToObject(&result)) return maybe_result; | 1597 if (!maybe_result->ToObject(&result)) return maybe_result; |
1558 } | 1598 } |
1559 Code* code = Code::cast(result); | 1599 Code* code = Code::cast(result); |
1560 USE(code); | 1600 USE(code); |
1561 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); | 1601 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); |
| 1602 GDBJIT(AddCode(GDBJITInterface::STUB, "ConstructStub", Code::cast(code))); |
1562 return result; | 1603 return result; |
1563 } | 1604 } |
1564 | 1605 |
1565 | 1606 |
1566 CallOptimization::CallOptimization(LookupResult* lookup) { | 1607 CallOptimization::CallOptimization(LookupResult* lookup) { |
1567 if (!lookup->IsProperty() || !lookup->IsCacheable() || | 1608 if (!lookup->IsProperty() || !lookup->IsCacheable() || |
1568 lookup->type() != CONSTANT_FUNCTION) { | 1609 lookup->type() != CONSTANT_FUNCTION) { |
1569 Initialize(NULL); | 1610 Initialize(NULL); |
1570 } else { | 1611 } else { |
1571 // We only optimize constant function calls. | 1612 // We only optimize constant function calls. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 expected_receiver_type_ = | 1665 expected_receiver_type_ = |
1625 FunctionTemplateInfo::cast(signature->receiver()); | 1666 FunctionTemplateInfo::cast(signature->receiver()); |
1626 } | 1667 } |
1627 } | 1668 } |
1628 | 1669 |
1629 is_simple_api_call_ = true; | 1670 is_simple_api_call_ = true; |
1630 } | 1671 } |
1631 | 1672 |
1632 | 1673 |
1633 } } // namespace v8::internal | 1674 } } // namespace v8::internal |
OLD | NEW |