Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5887396

Browse filesBrowse files
isheludkoofrobots
authored andcommitted
deps: cherry-pick a814b8a from upstream V8
Original commit message: Merged: [heap] Clear recorded slots for inobject properties when migrating fast object to slow mode. Revision: a814b8aeaf2b56635054c96435972dce90576f62 BUG=chromium:666046 LOG=N NOTRY=true NOPRESUBMIT=true NOTREECHECKS=true R=ulan@chromium.org Review URL: https://codereview.chromium.org/2549803002 . Cr-Commit-Position: refs/branch-heads/5.5@{#60} Cr-Branched-From: 3cbd5838bd8376103daa45d69dade929ee4e0092-refs/heads/5.5.372@{#1} Cr-Branched-From: b3c8b0ce2c9af0528837d8309625118d4096553b-refs/heads/master@{#40015} PR-URL: #10733 Reviewed-By: Reviewed-By: jasnell - James M Snell <jasnell@gmail.com> Reviewed-By: mhdawson - Michael Dawson <michael_dawson@ca.ibm.com>
1 parent e07b651 commit 5887396
Copy full SHA for 5887396

File tree

Expand file treeCollapse file tree

3 files changed

+68
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+68
-4
lines changed
Open diff view settings
Collapse file

‎deps/v8/include/v8-version.h‎

Copy file name to clipboardExpand all lines: deps/v8/include/v8-version.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 5
1212
#define V8_MINOR_VERSION 4
1313
#define V8_BUILD_NUMBER 500
14-
#define V8_PATCH_LEVEL 45
14+
#define V8_PATCH_LEVEL 46
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)
Collapse file

‎deps/v8/src/objects.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/objects.cc
+10-3Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3449,9 +3449,16 @@ void MigrateFastToSlow(Handle<JSObject> object, Handle<Map> new_map,
34493449
// Ensure that in-object space of slow-mode object does not contain random
34503450
// garbage.
34513451
int inobject_properties = new_map->GetInObjectProperties();
3452-
for (int i = 0; i < inobject_properties; i++) {
3453-
FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i);
3454-
object->RawFastPropertyAtPut(index, Smi::FromInt(0));
3452+
if (inobject_properties) {
3453+
Heap* heap = isolate->heap();
3454+
heap->ClearRecordedSlotRange(
3455+
object->address() + map->GetInObjectPropertyOffset(0),
3456+
object->address() + new_instance_size);
3457+
3458+
for (int i = 0; i < inobject_properties; i++) {
3459+
FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i);
3460+
object->RawFastPropertyAtPut(index, Smi::FromInt(0));
3461+
}
34553462
}
34563463

34573464
isolate->counters()->props_to_dictionary()->Increment();
Collapse file
+57Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Copyright 2016 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --allow-natives-syntax --expose-gc
6+
7+
function P() {
8+
this.a0 = {};
9+
this.a1 = {};
10+
this.a2 = {};
11+
this.a3 = {};
12+
this.a4 = {};
13+
}
14+
15+
function A() {
16+
}
17+
18+
var proto = new P();
19+
A.prototype = proto;
20+
21+
function foo(o) {
22+
return o.a0;
23+
}
24+
25+
// Ensure |proto| is in old space.
26+
gc();
27+
gc();
28+
gc();
29+
30+
// Ensure |proto| is marked as "should be fast".
31+
var o = new A();
32+
foo(o);
33+
foo(o);
34+
foo(o);
35+
assertTrue(%HasFastProperties(proto));
36+
37+
// Contruct a double value that looks like a tagged pointer.
38+
var buffer = new ArrayBuffer(8);
39+
var int32view = new Int32Array(buffer);
40+
var float64view = new Float64Array(buffer);
41+
int32view[0] = int32view[1] = 0x40000001;
42+
var boom = float64view[0];
43+
44+
45+
// Write new space object.
46+
proto.a4 = {a: 0};
47+
// Immediately delete the field.
48+
delete proto.a4;
49+
50+
// |proto| must sill be fast.
51+
assertTrue(%HasFastProperties(proto));
52+
53+
// Add a double field instead of deleted a4 that looks like a tagged pointer.
54+
proto.boom = boom;
55+
56+
// Boom!
57+
gc();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.