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

Issue 238973003: Handlify Object::GetPrototype and (most) callers. (Closed)

Created:
6 years, 8 months ago by Dmitry Lomov (no reviews)
Modified:
6 years, 8 months ago
Reviewers:
Yang
CC:
v8-dev
Visibility:
Public.

Description

Handlify Object::GetPrototype and (most) callers. R=yangguo@chromium.org

Patch Set 1 #

Patch Set 2 : Minor #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+130 lines, -104 lines) Patch
M src/accessors.cc View 8 chunks +40 lines, -36 lines 0 comments Download
M src/api.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/builtins.cc View 4 chunks +26 lines, -14 lines 1 comment Download
M src/handles.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/hydrogen.cc View 1 chunk +5 lines, -5 lines 0 comments Download
M src/ic.h View 1 chunk +4 lines, -3 lines 0 comments Download
M src/ic.cc View 3 chunks +4 lines, -4 lines 1 comment Download
M src/ic-inl.h View 1 chunk +6 lines, -6 lines 1 comment Download
M src/isolate.cc View 1 chunk +3 lines, -3 lines 1 comment Download
M src/objects.h View 1 2 chunks +3 lines, -1 line 0 comments Download
M src/objects.cc View 5 chunks +22 lines, -20 lines 3 comments Download
M src/runtime.cc View 5 chunks +7 lines, -5 lines 2 comments Download
M src/string-stream.cc View 1 chunk +8 lines, -5 lines 1 comment Download

Messages

Total messages: 2 (0 generated)
Dmitry Lomov (no reviews)
PTAL
6 years, 8 months ago (2014-04-15 12:44:56 UTC) #1
Yang
6 years, 8 months ago (2014-04-15 13:10:48 UTC) #2
Object::GetPrototype does not allocate, so it cannot cause a GC. I'm fine with
using the handlified wrapper of Object::GetPrototype inside already handlified
functions.

But using it inside functions that use raw object pointers is misleading and
potentially dangerous: it appears to make the call to Object::GetProperty
GC-safe, but the surrounding code (including the callers of those functions)
that are not handlified are not GC-safe at all. Imagine we would at some point
require Object::GetPrototype to actually allocate, then this would cause all
those unsafe parts to fail.

https://codereview.chromium.org/238973003/diff/20001/src/builtins.cc
File src/builtins.cc (right):

https://codereview.chromium.org/238973003/diff/20001/src/builtins.cc#newcode1114
src/builtins.cc:1114: Handle<FunctionTemplateInfo> type) {
It seems like we don't need to handlify this and its callers.

https://codereview.chromium.org/238973003/diff/20001/src/ic-inl.h
File src/ic-inl.h (right):

https://codereview.chromium.org/238973003/diff/20001/src/ic-inl.h#newcode162
src/ic-inl.h:162: InlineCacheHolderFlag holder) {
No need to handlify.

https://codereview.chromium.org/238973003/diff/20001/src/ic.cc
File src/ic.cc (right):

https://codereview.chromium.org/238973003/diff/20001/src/ic.cc#newcode265
src/ic.cc:265: if (Object::GetPrototype(isolate(), receiver)->IsNull()) return
false;
No need to handlify this.

https://codereview.chromium.org/238973003/diff/20001/src/isolate.cc
File src/isolate.cc (right):

https://codereview.chromium.org/238973003/diff/20001/src/isolate.cc#newcode1037
src/isolate.cc:1037: prototype = Object::GetPrototype(this, prototype)) {
The DisallowHeapAllocation scope should already make sure that this is safe
without being handlified.

https://codereview.chromium.org/238973003/diff/20001/src/objects.cc
File src/objects.cc (right):

https://codereview.chromium.org/238973003/diff/20001/src/objects.cc#newcode3437
src/objects.cc:3437: for (Handle<Object> pt = handle(GetPrototype(), isolate);
No need to handlify. Especially since none of the callers of this method is
handlified either.

https://codereview.chromium.org/238973003/diff/20001/src/objects.cc#newcode6433
src/objects.cc:6433: DisallowHeapAllocation no_alloc;
No need to handlify.

https://codereview.chromium.org/238973003/diff/20001/src/objects.cc#newcode11999
src/objects.cc:11999: if (JSReceiver::cast(*pt) == *object) {
you could use
if (pt.is_identical_to(object)) { ... }

https://codereview.chromium.org/238973003/diff/20001/src/runtime.cc
File src/runtime.cc (right):

https://codereview.chromium.org/238973003/diff/20001/src/runtime.cc#newcode12829
src/runtime.cc:12829: result = handle(JSObject::cast(*proto));
Use Handle<JSObject>::cast here. That will not create a new handle on the handle
stack.

https://codereview.chromium.org/238973003/diff/20001/src/runtime.cc#newcode13011
src/runtime.cc:13011: *Object::GetPrototype(isolate, handle(V, isolate));
This function is not handlified. Please don't do it in part.

https://codereview.chromium.org/238973003/diff/20001/src/string-stream.cc
File src/string-stream.cc (right):

https://codereview.chromium.org/238973003/diff/20001/src/string-stream.cc#new...
src/string-stream.cc:513: p = Object::GetPrototype(isolate, p)) {
Please don't handlify here.

Powered by Google App Engine
This is Rietveld 408576698