HConstant::InNewSpace() should be a constant function (issue 14455004)

1 view
Skip to first unread message

mvst...@chromium.org

unread,
Apr 26, 2013, 11:16:47 AM4/26/13
to verw...@chromium.org, v8-...@googlegroups.com
Reviewers: Toon Verwaest,

Message:
Hi Toon, If you could have a look,
--Michael

Description:
HConstant::InNewSpace() should be a constant function

BUG=

Please review this at https://codereview.chromium.org/14455004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
M src/hydrogen-instructions.h


Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index
65a9c959887a2eb926c918a95cc2fcd805047359..d800e3094f919191bdbde3c52bfc3a1dad88424e
100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -3251,7 +3251,7 @@ class HConstant: public HTemplateInstruction<0> {

Handle<Object> handle() {
if (handle_.is_null()) {
- handle_ = FACTORY->NewNumber(double_value_, TENURED);
+ handle_ = FACTORY->NewNumber(double_value_, pretenure());
}
ALLOW_HANDLE_DEREF(Isolate::Current(), "smi check");
ASSERT(has_int32_value_ || !handle_->IsSmi());
@@ -3265,10 +3265,15 @@ class HConstant: public HTemplateInstruction<0> {
std::isnan(double_value_));
}

- bool InNewSpace() {
- if (handle().is_null()) return false;
- ALLOW_HANDLE_DEREF(isolate(), "using raw address");
- return isolate()->heap()->InNewSpace(*handle());
+ bool InNewSpace() const {
+ if (!handle_.is_null()) {
+ ALLOW_HANDLE_DEREF(isolate(), "using raw address");
+ return isolate()->heap()->InNewSpace(*handle_);
+ }
+ // If the handle wasn't created yet, then we have a number.
+ // If the handle is created it'll be tenured in old space.
+ ASSERT(pretenure() == TENURED);
+ return false;
}

bool ImmortalImmovable() const {
@@ -3406,6 +3411,8 @@ class HConstant: public HTemplateInstruction<0> {
// HeapObject the constant originated from or is null. If the
// constant is non-numeric, handle_ always points to a valid
// constant HeapObject.
+ static PretenureFlag pretenure() { return TENURED; }
+
Handle<Object> handle_;
UniqueValueId unique_id_;



verw...@chromium.org

unread,
Apr 26, 2013, 11:35:00 AM4/26/13
to mvst...@chromium.org, v8-...@googlegroups.com

mvst...@chromium.org

unread,
Apr 26, 2013, 11:48:18 AM4/26/13
to verw...@chromium.org, v8-...@googlegroups.com
Committed patchset #1 manually as r14466 (presubmit successful).

https://codereview.chromium.org/14455004/
Reply all
Reply to author
Forward
0 new messages