OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2682 FixedArray::cast(elements)->set(0, Smi::FromInt(0)); | 2682 FixedArray::cast(elements)->set(0, Smi::FromInt(0)); |
2683 JSObject::cast(obj)->set_elements(FixedArray::cast(elements)); | 2683 JSObject::cast(obj)->set_elements(FixedArray::cast(elements)); |
2684 set_message_listeners(JSObject::cast(obj)); | 2684 set_message_listeners(JSObject::cast(obj)); |
2685 | 2685 |
2686 return true; | 2686 return true; |
2687 } | 2687 } |
2688 | 2688 |
2689 | 2689 |
2690 void Heap::CreateJSEntryStub() { | 2690 void Heap::CreateJSEntryStub() { |
2691 JSEntryStub stub; | 2691 JSEntryStub stub; |
2692 set_js_entry_code(*stub.GetCode()); | 2692 set_js_entry_code(*stub.GetCode(isolate())); |
2693 } | 2693 } |
2694 | 2694 |
2695 | 2695 |
2696 void Heap::CreateJSConstructEntryStub() { | 2696 void Heap::CreateJSConstructEntryStub() { |
2697 JSConstructEntryStub stub; | 2697 JSConstructEntryStub stub; |
2698 set_js_construct_entry_code(*stub.GetCode()); | 2698 set_js_construct_entry_code(*stub.GetCode(isolate())); |
2699 } | 2699 } |
2700 | 2700 |
2701 | 2701 |
2702 void Heap::CreateFixedStubs() { | 2702 void Heap::CreateFixedStubs() { |
2703 // Here we create roots for fixed stubs. They are needed at GC | 2703 // Here we create roots for fixed stubs. They are needed at GC |
2704 // for cooking and uncooking (check out frames.cc). | 2704 // for cooking and uncooking (check out frames.cc). |
2705 // The eliminates the need for doing dictionary lookup in the | 2705 // The eliminates the need for doing dictionary lookup in the |
2706 // stub cache for these stubs. | 2706 // stub cache for these stubs. |
2707 HandleScope scope(isolate()); | 2707 HandleScope scope(isolate()); |
2708 // gcc-4.4 has problem generating correct code of following snippet: | 2708 // gcc-4.4 has problem generating correct code of following snippet: |
2709 // { JSEntryStub stub; | 2709 // { JSEntryStub stub; |
2710 // js_entry_code_ = *stub.GetCode(); | 2710 // js_entry_code_ = *stub.GetCode(); |
2711 // } | 2711 // } |
2712 // { JSConstructEntryStub stub; | 2712 // { JSConstructEntryStub stub; |
2713 // js_construct_entry_code_ = *stub.GetCode(); | 2713 // js_construct_entry_code_ = *stub.GetCode(); |
2714 // } | 2714 // } |
2715 // To workaround the problem, make separate functions without inlining. | 2715 // To workaround the problem, make separate functions without inlining. |
2716 Heap::CreateJSEntryStub(); | 2716 Heap::CreateJSEntryStub(); |
2717 Heap::CreateJSConstructEntryStub(); | 2717 Heap::CreateJSConstructEntryStub(); |
2718 | 2718 |
2719 // Create stubs that should be there, so we don't unexpectedly have to | 2719 // Create stubs that should be there, so we don't unexpectedly have to |
2720 // create them if we need them during the creation of another stub. | 2720 // create them if we need them during the creation of another stub. |
2721 // Stub creation mixes raw pointers and handles in an unsafe manner so | 2721 // Stub creation mixes raw pointers and handles in an unsafe manner so |
2722 // we cannot create stubs while we are creating stubs. | 2722 // we cannot create stubs while we are creating stubs. |
2723 CodeStub::GenerateStubsAheadOfTime(); | 2723 CodeStub::GenerateStubsAheadOfTime(isolate()); |
2724 } | 2724 } |
2725 | 2725 |
2726 | 2726 |
2727 bool Heap::CreateInitialObjects() { | 2727 bool Heap::CreateInitialObjects() { |
2728 Object* obj; | 2728 Object* obj; |
2729 | 2729 |
2730 // The -0 value must be set before NumberFromDouble works. | 2730 // The -0 value must be set before NumberFromDouble works. |
2731 { MaybeObject* maybe_obj = AllocateHeapNumber(-0.0, TENURED); | 2731 { MaybeObject* maybe_obj = AllocateHeapNumber(-0.0, TENURED); |
2732 if (!maybe_obj->ToObject(&obj)) return false; | 2732 if (!maybe_obj->ToObject(&obj)) return false; |
2733 } | 2733 } |
(...skipping 4802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7536 static_cast<int>(object_sizes_last_time_[index])); | 7536 static_cast<int>(object_sizes_last_time_[index])); |
7537 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7537 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7538 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7538 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7539 | 7539 |
7540 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7540 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7541 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7541 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7542 ClearObjectStats(); | 7542 ClearObjectStats(); |
7543 } | 7543 } |
7544 | 7544 |
7545 } } // namespace v8::internal | 7545 } } // namespace v8::internal |
OLD | NEW |