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

Issue 11979003: Add a new operator |= which does a simple assignment of the raw pointer into (Closed)

Created:
7 years, 11 months ago by siva
Modified:
7 years, 11 months ago
Reviewers:
Ivan Posva
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add a new operator |= which does a simple assignment of the raw pointer into a handle without any vtable settings. In debug mode there are the usual checks to ensure that the vtable in the handle matches the expected vtable value based on the dynamic type of the object. It is useful in loopy code as follows: const Array& funcs = class.functions(); Function func = Function::Handle(); for (int i = 0; i < 100000000; i++) { func |= funcs.At(i); } Committed: https://code.google.com/p/dart/source/detail?r=17244

Patch Set 1 #

Patch Set 2 : #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+76 lines, -39 lines) Patch
M runtime/vm/object.h View 3 chunks +11 lines, -0 lines 0 comments Download
M runtime/vm/object.cc View 1 28 chunks +65 lines, -39 lines 2 comments Download

Messages

Total messages: 4 (0 generated)
siva
7 years, 11 months ago (2013-01-17 22:03:34 UTC) #1
siva
7 years, 11 months ago (2013-01-17 22:19:26 UTC) #2
Ivan Posva
LGTMwC -ip https://chromiumcodereview.appspot.com/11979003/diff/4001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://chromiumcodereview.appspot.com/11979003/diff/4001/runtime/vm/object.cc#newcode1210 runtime/vm/object.cc:1210: isolate->class_table()->At(cid)->ptr()->handle_vtable_); Do we really need to check ...
7 years, 11 months ago (2013-01-17 23:24:23 UTC) #3
siva
7 years, 11 months ago (2013-01-18 00:08:38 UTC) #4
https://chromiumcodereview.appspot.com/11979003/diff/4001/runtime/vm/object.cc
File runtime/vm/object.cc (right):

https://chromiumcodereview.appspot.com/11979003/diff/4001/runtime/vm/object.c...
runtime/vm/object.cc:1210:
isolate->class_table()->At(cid)->ptr()->handle_vtable_);
True, this assertion can be pulled out into a one time assertion which is done
in dart::InitializeIsolate().

Will make this change in another CL.

On 2013/01/17 23:24:23, Ivan Posva wrote:
> Do we really need to check this one-time assertion for every handle
assignment?

Powered by Google App Engine
This is Rietveld 408576698