| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 enum StubKind { | 344 enum StubKind { |
| 345 LOAD, | 345 LOAD, |
| 346 STORE_NO_TRANSITION, | 346 STORE_NO_TRANSITION, |
| 347 STORE_TRANSITION_SMI_TO_OBJECT, | 347 STORE_TRANSITION_SMI_TO_OBJECT, |
| 348 STORE_TRANSITION_SMI_TO_DOUBLE, | 348 STORE_TRANSITION_SMI_TO_DOUBLE, |
| 349 STORE_TRANSITION_DOUBLE_TO_OBJECT | 349 STORE_TRANSITION_DOUBLE_TO_OBJECT |
| 350 }; | 350 }; |
| 351 explicit KeyedIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) {} | 351 explicit KeyedIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) {} |
| 352 virtual ~KeyedIC() {} | 352 virtual ~KeyedIC() {} |
| 353 | 353 |
| 354 virtual MaybeObject* GetElementStubWithoutMapCheck( | 354 virtual Handle<Code> GetElementStubWithoutMapCheck( |
| 355 bool is_js_array, | 355 bool is_js_array, |
| 356 ElementsKind elements_kind) = 0; | 356 ElementsKind elements_kind) = 0; |
| 357 | 357 |
| 358 protected: | 358 protected: |
| 359 virtual Handle<Code> string_stub() { | 359 virtual Handle<Code> string_stub() { |
| 360 return Handle<Code>::null(); | 360 return Handle<Code>::null(); |
| 361 } | 361 } |
| 362 | 362 |
| 363 virtual Code::Kind kind() const = 0; | 363 virtual Code::Kind kind() const = 0; |
| 364 | 364 |
| 365 Handle<Code> ComputeStub(Handle<JSObject> receiver, | 365 Handle<Code> ComputeStub(Handle<JSObject> receiver, |
| 366 StubKind stub_kind, | 366 StubKind stub_kind, |
| 367 StrictModeFlag strict_mode, | 367 StrictModeFlag strict_mode, |
| 368 Handle<Code> default_stub); | 368 Handle<Code> default_stub); |
| 369 | 369 |
| 370 MaybeObject* ComputeStub(JSObject* receiver, | 370 virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps, |
| 371 StubKind stub_kind, | |
| 372 StrictModeFlag strict_mode, | |
| 373 Code* default_stub); | |
| 374 | |
| 375 virtual MaybeObject* ComputePolymorphicStub(MapList* receiver_maps, | |
| 376 StrictModeFlag strict_mode) = 0; | 371 StrictModeFlag strict_mode) = 0; |
| 377 | 372 |
| 378 MaybeObject* ComputeMonomorphicStubWithoutMapCheck( | 373 Handle<Code> ComputeMonomorphicStubWithoutMapCheck( |
| 379 Map* receiver_map, | 374 Handle<Map> receiver_map, |
| 380 StrictModeFlag strict_mode); | 375 StrictModeFlag strict_mode); |
| 381 | 376 |
| 382 private: | 377 private: |
| 383 void GetReceiverMapsForStub(Code* stub, MapList* result); | 378 void GetReceiverMapsForStub(Handle<Code> stub, MapHandleList* result); |
| 384 | 379 |
| 385 MaybeObject* ComputeMonomorphicStub(JSObject* receiver, | 380 Handle<Code> ComputeMonomorphicStub(Handle<JSObject> receiver, |
| 386 StubKind stub_kind, | 381 StubKind stub_kind, |
| 387 StrictModeFlag strict_mode, | 382 StrictModeFlag strict_mode, |
| 388 Code* default_stub); | 383 Handle<Code> default_stub); |
| 389 | 384 |
| 390 MaybeObject* ComputeTransitionedMap(JSObject* receiver, StubKind stub_kind); | 385 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver, |
| 386 StubKind stub_kind); |
| 391 | 387 |
| 392 static bool IsTransitionStubKind(StubKind stub_kind) { | 388 static bool IsTransitionStubKind(StubKind stub_kind) { |
| 393 return stub_kind > STORE_NO_TRANSITION; | 389 return stub_kind > STORE_NO_TRANSITION; |
| 394 } | 390 } |
| 395 }; | 391 }; |
| 396 | 392 |
| 397 | 393 |
| 398 class KeyedLoadIC: public KeyedIC { | 394 class KeyedLoadIC: public KeyedIC { |
| 399 public: | 395 public: |
| 400 explicit KeyedLoadIC(Isolate* isolate) : KeyedIC(isolate) { | 396 explicit KeyedLoadIC(Isolate* isolate) : KeyedIC(isolate) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 420 static void GenerateIndexedInterceptor(MacroAssembler* masm); | 416 static void GenerateIndexedInterceptor(MacroAssembler* masm); |
| 421 static void GenerateNonStrictArguments(MacroAssembler* masm); | 417 static void GenerateNonStrictArguments(MacroAssembler* masm); |
| 422 | 418 |
| 423 // Bit mask to be tested against bit field for the cases when | 419 // Bit mask to be tested against bit field for the cases when |
| 424 // generic stub should go into slow case. | 420 // generic stub should go into slow case. |
| 425 // Access check is necessary explicitly since generic stub does not perform | 421 // Access check is necessary explicitly since generic stub does not perform |
| 426 // map checks. | 422 // map checks. |
| 427 static const int kSlowCaseBitFieldMask = | 423 static const int kSlowCaseBitFieldMask = |
| 428 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); | 424 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); |
| 429 | 425 |
| 430 virtual MaybeObject* GetElementStubWithoutMapCheck( | 426 virtual Handle<Code> GetElementStubWithoutMapCheck( |
| 431 bool is_js_array, | 427 bool is_js_array, |
| 432 ElementsKind elements_kind); | 428 ElementsKind elements_kind); |
| 433 | 429 |
| 434 protected: | 430 protected: |
| 435 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; } | 431 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; } |
| 436 | 432 |
| 437 virtual MaybeObject* ComputePolymorphicStub( | 433 virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps, |
| 438 MapList* receiver_maps, | 434 StrictModeFlag strict_mode); |
| 439 StrictModeFlag strict_mode); | |
| 440 | 435 |
| 441 virtual Handle<Code> string_stub() { | 436 virtual Handle<Code> string_stub() { |
| 442 return isolate()->builtins()->KeyedLoadIC_String(); | 437 return isolate()->builtins()->KeyedLoadIC_String(); |
| 443 } | 438 } |
| 444 | 439 |
| 445 private: | 440 private: |
| 446 // Update the inline cache. | 441 // Update the inline cache. |
| 447 void UpdateCaches(LookupResult* lookup, | 442 void UpdateCaches(LookupResult* lookup, |
| 448 State state, | 443 State state, |
| 449 Handle<Object> object, | 444 Handle<Object> object, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 } | 559 } |
| 565 static void GenerateMiss(MacroAssembler* masm, bool force_generic); | 560 static void GenerateMiss(MacroAssembler* masm, bool force_generic); |
| 566 static void GenerateSlow(MacroAssembler* masm); | 561 static void GenerateSlow(MacroAssembler* masm); |
| 567 static void GenerateRuntimeSetProperty(MacroAssembler* masm, | 562 static void GenerateRuntimeSetProperty(MacroAssembler* masm, |
| 568 StrictModeFlag strict_mode); | 563 StrictModeFlag strict_mode); |
| 569 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); | 564 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); |
| 570 static void GenerateNonStrictArguments(MacroAssembler* masm); | 565 static void GenerateNonStrictArguments(MacroAssembler* masm); |
| 571 static void GenerateTransitionElementsSmiToDouble(MacroAssembler* masm); | 566 static void GenerateTransitionElementsSmiToDouble(MacroAssembler* masm); |
| 572 static void GenerateTransitionElementsDoubleToObject(MacroAssembler* masm); | 567 static void GenerateTransitionElementsDoubleToObject(MacroAssembler* masm); |
| 573 | 568 |
| 574 virtual MaybeObject* GetElementStubWithoutMapCheck( | 569 virtual Handle<Code> GetElementStubWithoutMapCheck( |
| 575 bool is_js_array, | 570 bool is_js_array, |
| 576 ElementsKind elements_kind); | 571 ElementsKind elements_kind); |
| 577 | 572 |
| 578 protected: | 573 protected: |
| 579 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } | 574 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } |
| 580 | 575 |
| 581 virtual MaybeObject* ComputePolymorphicStub( | 576 virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps, |
| 582 MapList* receiver_maps, | 577 StrictModeFlag strict_mode); |
| 583 StrictModeFlag strict_mode); | |
| 584 | 578 |
| 585 private: | 579 private: |
| 586 // Update the inline cache. | 580 // Update the inline cache. |
| 587 void UpdateCaches(LookupResult* lookup, | 581 void UpdateCaches(LookupResult* lookup, |
| 588 State state, | 582 State state, |
| 589 StrictModeFlag strict_mode, | 583 StrictModeFlag strict_mode, |
| 590 Handle<JSObject> receiver, | 584 Handle<JSObject> receiver, |
| 591 Handle<String> name, | 585 Handle<String> name, |
| 592 Handle<Object> value); | 586 Handle<Object> value); |
| 593 | 587 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 void patch(Code* code); | 724 void patch(Code* code); |
| 731 }; | 725 }; |
| 732 | 726 |
| 733 | 727 |
| 734 // Helper for BinaryOpIC and CompareIC. | 728 // Helper for BinaryOpIC and CompareIC. |
| 735 void PatchInlinedSmiCode(Address address); | 729 void PatchInlinedSmiCode(Address address); |
| 736 | 730 |
| 737 } } // namespace v8::internal | 731 } } // namespace v8::internal |
| 738 | 732 |
| 739 #endif // V8_IC_H_ | 733 #endif // V8_IC_H_ |
| OLD | NEW |