Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: src/snapshot/serialize.cc

Issue 1065863003: Use array literals instead of array constructor in native javascript. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase and fix Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/regexp.js ('k') | src/string.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 // If this is not the case you may have to add something to the root array. 1570 // If this is not the case you may have to add something to the root array.
1571 DCHECK(!startup_serializer_->back_reference_map()->Lookup(obj).is_valid()); 1571 DCHECK(!startup_serializer_->back_reference_map()->Lookup(obj).is_valid());
1572 // All the internalized strings that the partial snapshot needs should be 1572 // All the internalized strings that the partial snapshot needs should be
1573 // either in the root table or in the partial snapshot cache. 1573 // either in the root table or in the partial snapshot cache.
1574 DCHECK(!obj->IsInternalizedString()); 1574 DCHECK(!obj->IsInternalizedString());
1575 1575
1576 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; 1576 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return;
1577 1577
1578 FlushSkip(skip); 1578 FlushSkip(skip);
1579 1579
1580 // Clear literal boilerplates.
1581 if (obj->IsJSFunction() && !JSFunction::cast(obj)->shared()->bound()) {
1582 FixedArray* literals = JSFunction::cast(obj)->literals();
1583 for (int i = 0; i < literals->length(); i++) literals->set_undefined(i);
1584 }
1585
1580 // Object has not yet been serialized. Serialize it here. 1586 // Object has not yet been serialized. Serialize it here.
1581 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); 1587 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point);
1582 serializer.Serialize(); 1588 serializer.Serialize();
1583 1589
1584 if (obj->IsContext() && 1590 if (obj->IsContext() &&
1585 Context::cast(obj)->global_object() == global_object_) { 1591 Context::cast(obj)->global_object() == global_object_) {
1586 // Context refers to the current global object. This reference will 1592 // Context refers to the current global object. This reference will
1587 // become outdated after deserialization. 1593 // become outdated after deserialization.
1588 BackReference back_reference = back_reference_map_.Lookup(obj); 1594 BackReference back_reference = back_reference_map_.Lookup(obj);
1589 DCHECK(back_reference.is_valid()); 1595 DCHECK(back_reference.is_valid());
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 DisallowHeapAllocation no_gc; 2529 DisallowHeapAllocation no_gc;
2524 SerializedCodeData* scd = new SerializedCodeData(cached_data); 2530 SerializedCodeData* scd = new SerializedCodeData(cached_data);
2525 SanityCheckResult r = scd->SanityCheck(isolate, source); 2531 SanityCheckResult r = scd->SanityCheck(isolate, source);
2526 if (r == CHECK_SUCCESS) return scd; 2532 if (r == CHECK_SUCCESS) return scd;
2527 cached_data->Reject(); 2533 cached_data->Reject();
2528 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); 2534 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r);
2529 delete scd; 2535 delete scd;
2530 return NULL; 2536 return NULL;
2531 } 2537 }
2532 } } // namespace v8::internal 2538 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/regexp.js ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698