OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 class StubCompiler BASE_EMBEDDED { | 317 class StubCompiler BASE_EMBEDDED { |
318 public: | 318 public: |
319 enum CheckType { | 319 enum CheckType { |
320 RECEIVER_MAP_CHECK, | 320 RECEIVER_MAP_CHECK, |
321 STRING_CHECK, | 321 STRING_CHECK, |
322 NUMBER_CHECK, | 322 NUMBER_CHECK, |
323 BOOLEAN_CHECK, | 323 BOOLEAN_CHECK, |
324 JSARRAY_HAS_FAST_ELEMENTS_CHECK | 324 JSARRAY_HAS_FAST_ELEMENTS_CHECK |
325 }; | 325 }; |
326 | 326 |
327 StubCompiler() : scope_(), masm_(NULL, 256) { } | 327 StubCompiler() : scope_(), masm_(NULL, 256), failure_(NULL) { } |
328 | 328 |
329 Object* CompileCallInitialize(Code::Flags flags); | 329 Object* CompileCallInitialize(Code::Flags flags); |
330 Object* CompileCallPreMonomorphic(Code::Flags flags); | 330 Object* CompileCallPreMonomorphic(Code::Flags flags); |
331 Object* CompileCallNormal(Code::Flags flags); | 331 Object* CompileCallNormal(Code::Flags flags); |
332 Object* CompileCallMegamorphic(Code::Flags flags); | 332 Object* CompileCallMegamorphic(Code::Flags flags); |
333 Object* CompileCallMiss(Code::Flags flags); | 333 Object* CompileCallMiss(Code::Flags flags); |
334 #ifdef ENABLE_DEBUGGER_SUPPORT | 334 #ifdef ENABLE_DEBUGGER_SUPPORT |
335 Object* CompileCallDebugBreak(Code::Flags flags); | 335 Object* CompileCallDebugBreak(Code::Flags flags); |
336 Object* CompileCallDebugPrepareStepIn(Code::Flags flags); | 336 Object* CompileCallDebugPrepareStepIn(Code::Flags flags); |
337 #endif | 337 #endif |
338 Object* CompileLazyCompile(Code::Flags flags); | 338 Object* CompileLazyCompile(Code::Flags flags); |
339 | 339 |
340 // Static functions for generating parts of stubs. | 340 // Static functions for generating parts of stubs. |
341 static void GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, | 341 static void GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, |
342 int index, | 342 int index, |
343 Register prototype); | 343 Register prototype); |
344 static void GenerateFastPropertyLoad(MacroAssembler* masm, | 344 static void GenerateFastPropertyLoad(MacroAssembler* masm, |
345 Register dst, Register src, | 345 Register dst, Register src, |
346 JSObject* holder, int index); | 346 JSObject* holder, int index); |
347 static void GenerateLoadField(MacroAssembler* masm, | 347 |
348 JSObject* object, | |
349 JSObject* holder, | |
350 Register receiver, | |
351 Register scratch1, | |
352 Register scratch2, | |
353 int index, | |
354 Label* miss_label); | |
355 static void GenerateLoadCallback(MacroAssembler* masm, | |
356 JSObject* object, | |
357 JSObject* holder, | |
358 Register receiver, | |
359 Register name, | |
360 Register scratch1, | |
361 Register scratch2, | |
362 AccessorInfo* callback, | |
363 Label* miss_label); | |
364 static void GenerateLoadConstant(MacroAssembler* masm, | |
365 JSObject* object, | |
366 JSObject* holder, | |
367 Register receiver, | |
368 Register scratch1, | |
369 Register scratch2, | |
370 Object* value, | |
371 Label* miss_label); | |
372 static void GenerateLoadInterceptor(MacroAssembler* masm, | |
373 JSObject* object, | |
374 JSObject* holder, | |
375 Smi* lookup_hint, | |
376 Register receiver, | |
377 Register name, | |
378 Register scratch1, | |
379 Register scratch2, | |
380 Label* miss_label); | |
381 static void GenerateLoadArrayLength(MacroAssembler* masm, | 348 static void GenerateLoadArrayLength(MacroAssembler* masm, |
382 Register receiver, | 349 Register receiver, |
383 Register scratch, | 350 Register scratch, |
384 Label* miss_label); | 351 Label* miss_label); |
385 static void GenerateLoadStringLength(MacroAssembler* masm, | 352 static void GenerateLoadStringLength(MacroAssembler* masm, |
386 Register receiver, | 353 Register receiver, |
387 Register scratch, | 354 Register scratch, |
388 Label* miss_label); | 355 Label* miss_label); |
389 static void GenerateLoadStringLength2(MacroAssembler* masm, | 356 static void GenerateLoadStringLength2(MacroAssembler* masm, |
390 Register receiver, | 357 Register receiver, |
(...skipping 14 matching lines...) Expand all Loading... |
405 Register name_reg, | 372 Register name_reg, |
406 Register scratch, | 373 Register scratch, |
407 Label* miss_label); | 374 Label* miss_label); |
408 static void GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind); | 375 static void GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind); |
409 | 376 |
410 protected: | 377 protected: |
411 Object* GetCodeWithFlags(Code::Flags flags, const char* name); | 378 Object* GetCodeWithFlags(Code::Flags flags, const char* name); |
412 Object* GetCodeWithFlags(Code::Flags flags, String* name); | 379 Object* GetCodeWithFlags(Code::Flags flags, String* name); |
413 | 380 |
414 MacroAssembler* masm() { return &masm_; } | 381 MacroAssembler* masm() { return &masm_; } |
| 382 void set_failure(Failure* failure) { failure_ = failure; } |
| 383 |
| 384 // Check the integrity of the prototype chain to make sure that the |
| 385 // current IC is still valid. |
| 386 Register CheckPrototypes(JSObject* object, |
| 387 Register object_reg, |
| 388 JSObject* holder, |
| 389 Register holder_reg, |
| 390 Register scratch, |
| 391 String* name, |
| 392 Label* miss); |
| 393 |
| 394 void GenerateLoadField(JSObject* object, |
| 395 JSObject* holder, |
| 396 Register receiver, |
| 397 Register scratch1, |
| 398 Register scratch2, |
| 399 int index, |
| 400 String* name, |
| 401 Label* miss); |
| 402 |
| 403 void GenerateLoadCallback(JSObject* object, |
| 404 JSObject* holder, |
| 405 Register receiver, |
| 406 Register name_reg, |
| 407 Register scratch1, |
| 408 Register scratch2, |
| 409 AccessorInfo* callback, |
| 410 String* name, |
| 411 Label* miss); |
| 412 |
| 413 void GenerateLoadConstant(JSObject* object, |
| 414 JSObject* holder, |
| 415 Register receiver, |
| 416 Register scratch1, |
| 417 Register scratch2, |
| 418 Object* value, |
| 419 String* name, |
| 420 Label* miss); |
| 421 |
| 422 void GenerateLoadInterceptor(JSObject* object, |
| 423 JSObject* holder, |
| 424 Smi* lookup_hint, |
| 425 Register receiver, |
| 426 Register name_reg, |
| 427 Register scratch1, |
| 428 Register scratch2, |
| 429 String* name, |
| 430 Label* miss); |
415 | 431 |
416 private: | 432 private: |
417 HandleScope scope_; | 433 HandleScope scope_; |
418 MacroAssembler masm_; | 434 MacroAssembler masm_; |
| 435 Failure* failure_; |
419 }; | 436 }; |
420 | 437 |
421 | 438 |
422 class LoadStubCompiler: public StubCompiler { | 439 class LoadStubCompiler: public StubCompiler { |
423 public: | 440 public: |
424 Object* CompileLoadField(JSObject* object, | 441 Object* CompileLoadField(JSObject* object, |
425 JSObject* holder, | 442 JSObject* holder, |
426 int index, | 443 int index, |
427 String* name); | 444 String* name); |
428 Object* CompileLoadCallback(JSObject* object, | 445 Object* CompileLoadCallback(JSObject* object, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 explicit CallStubCompiler(int argc, InLoopFlag in_loop) | 528 explicit CallStubCompiler(int argc, InLoopFlag in_loop) |
512 : arguments_(argc), in_loop_(in_loop) { } | 529 : arguments_(argc), in_loop_(in_loop) { } |
513 | 530 |
514 Object* CompileCallField(Object* object, | 531 Object* CompileCallField(Object* object, |
515 JSObject* holder, | 532 JSObject* holder, |
516 int index, | 533 int index, |
517 String* name); | 534 String* name); |
518 Object* CompileCallConstant(Object* object, | 535 Object* CompileCallConstant(Object* object, |
519 JSObject* holder, | 536 JSObject* holder, |
520 JSFunction* function, | 537 JSFunction* function, |
| 538 String* name, |
521 CheckType check); | 539 CheckType check); |
522 Object* CompileCallInterceptor(Object* object, | 540 Object* CompileCallInterceptor(Object* object, |
523 JSObject* holder, | 541 JSObject* holder, |
524 String* name); | 542 String* name); |
525 Object* CompileCallGlobal(JSObject* object, | 543 Object* CompileCallGlobal(JSObject* object, |
526 GlobalObject* holder, | 544 GlobalObject* holder, |
527 JSGlobalPropertyCell* cell, | 545 JSGlobalPropertyCell* cell, |
528 JSFunction* function, | 546 JSFunction* function, |
529 String* name); | 547 String* name); |
530 | 548 |
531 private: | 549 private: |
532 const ParameterCount arguments_; | 550 const ParameterCount arguments_; |
533 const InLoopFlag in_loop_; | 551 const InLoopFlag in_loop_; |
534 | 552 |
535 const ParameterCount& arguments() { return arguments_; } | 553 const ParameterCount& arguments() { return arguments_; } |
536 | 554 |
537 Object* GetCode(PropertyType type, String* name); | 555 Object* GetCode(PropertyType type, String* name); |
538 }; | 556 }; |
539 | 557 |
540 | 558 |
541 } } // namespace v8::internal | 559 } } // namespace v8::internal |
542 | 560 |
543 #endif // V8_STUB_CACHE_H_ | 561 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |