| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 SetAttachedObjects(attached_objects); | 615 SetAttachedObjects(attached_objects); |
| 616 | 616 |
| 617 DisallowHeapAllocation no_gc; | 617 DisallowHeapAllocation no_gc; |
| 618 // Keep track of the code space start and end pointers in case new | 618 // Keep track of the code space start and end pointers in case new |
| 619 // code objects were unserialized | 619 // code objects were unserialized |
| 620 OldSpace* code_space = isolate_->heap()->code_space(); | 620 OldSpace* code_space = isolate_->heap()->code_space(); |
| 621 Address start_address = code_space->top(); | 621 Address start_address = code_space->top(); |
| 622 Object* root; | 622 Object* root; |
| 623 Object* outdated_contexts; | 623 Object* outdated_contexts; |
| 624 VisitPointer(&root); | 624 VisitPointer(&root); |
| 625 DeserializeDeferredObjects(); |
| 625 VisitPointer(&outdated_contexts); | 626 VisitPointer(&outdated_contexts); |
| 626 DeserializeDeferredObjects(); | |
| 627 | 627 |
| 628 // There's no code deserialized here. If this assert fires | 628 // There's no code deserialized here. If this assert fires |
| 629 // then that's changed and logging should be added to notify | 629 // then that's changed and logging should be added to notify |
| 630 // the profiler et al of the new code. | 630 // the profiler et al of the new code. |
| 631 CHECK_EQ(start_address, code_space->top()); | 631 CHECK_EQ(start_address, code_space->top()); |
| 632 CHECK(outdated_contexts->IsFixedArray()); | 632 CHECK(outdated_contexts->IsFixedArray()); |
| 633 *outdated_contexts_out = | 633 *outdated_contexts_out = |
| 634 Handle<FixedArray>(FixedArray::cast(outdated_contexts), isolate); | 634 Handle<FixedArray>(FixedArray::cast(outdated_contexts), isolate); |
| 635 return Handle<Object>(root, isolate); | 635 return Handle<Object>(root, isolate); |
| 636 } | 636 } |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 } | 1324 } |
| 1325 | 1325 |
| 1326 | 1326 |
| 1327 void PartialSerializer::Serialize(Object** o) { | 1327 void PartialSerializer::Serialize(Object** o) { |
| 1328 if ((*o)->IsContext()) { | 1328 if ((*o)->IsContext()) { |
| 1329 Context* context = Context::cast(*o); | 1329 Context* context = Context::cast(*o); |
| 1330 global_object_ = context->global_object(); | 1330 global_object_ = context->global_object(); |
| 1331 back_reference_map()->AddGlobalProxy(context->global_proxy()); | 1331 back_reference_map()->AddGlobalProxy(context->global_proxy()); |
| 1332 } | 1332 } |
| 1333 VisitPointer(o); | 1333 VisitPointer(o); |
| 1334 SerializeDeferredObjects(); |
| 1334 SerializeOutdatedContextsAsFixedArray(); | 1335 SerializeOutdatedContextsAsFixedArray(); |
| 1335 SerializeDeferredObjects(); | |
| 1336 Pad(); | 1336 Pad(); |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 | 1339 |
| 1340 void PartialSerializer::SerializeOutdatedContextsAsFixedArray() { | 1340 void PartialSerializer::SerializeOutdatedContextsAsFixedArray() { |
| 1341 int length = outdated_contexts_.length(); | 1341 int length = outdated_contexts_.length(); |
| 1342 if (length == 0) { | 1342 if (length == 0) { |
| 1343 FixedArray* empty = isolate_->heap()->empty_fixed_array(); | 1343 FixedArray* empty = isolate_->heap()->empty_fixed_array(); |
| 1344 SerializeObject(empty, kPlain, kStartOfObject, 0); | 1344 SerializeObject(empty, kPlain, kStartOfObject, 0); |
| 1345 } else { | 1345 } else { |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2627 DisallowHeapAllocation no_gc; | 2627 DisallowHeapAllocation no_gc; |
| 2628 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2628 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
| 2629 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2629 SanityCheckResult r = scd->SanityCheck(isolate, source); |
| 2630 if (r == CHECK_SUCCESS) return scd; | 2630 if (r == CHECK_SUCCESS) return scd; |
| 2631 cached_data->Reject(); | 2631 cached_data->Reject(); |
| 2632 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2632 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
| 2633 delete scd; | 2633 delete scd; |
| 2634 return NULL; | 2634 return NULL; |
| 2635 } | 2635 } |
| 2636 } } // namespace v8::internal | 2636 } } // namespace v8::internal |
| OLD | NEW |