From bd0deb9443cd5996e4a3fc8099bfa80ffc5799b9 Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Wed, 26 Jun 2013 14:04:25 +0000 Subject: [PATCH] Remove obsolete unchecked accessors in JSFunction. R=hpayer@chromium.org BUG=v8:1490 Review URL: https://codereview.chromium.org/17833002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15338 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/frames.cc | 2 +- src/heap-snapshot-generator.cc | 4 ++-- src/mark-compact.cc | 4 ++-- src/objects-inl.h | 12 +----------- src/objects-printer.cc | 2 +- src/objects-visiting-inl.h | 2 +- src/objects.h | 3 --- src/string-stream.cc | 2 +- 8 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/frames.cc b/src/frames.cc index 80fe469..49a08ad 100644 --- a/src/frames.cc +++ b/src/frames.cc @@ -741,7 +741,7 @@ int JavaScriptFrame::GetArgumentsLength() const { Code* JavaScriptFrame::unchecked_code() const { JSFunction* function = JSFunction::cast(this->function()); - return function->unchecked_code(); + return function->code(); } diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc index 882f706..895c0da 100644 --- a/src/heap-snapshot-generator.cc +++ b/src/heap-snapshot-generator.cc @@ -1050,9 +1050,9 @@ void V8HeapExplorer::ExtractJSObjectReferences( SetInternalReference(js_fun, entry, "shared", shared_info, JSFunction::kSharedFunctionInfoOffset); - TagObject(js_fun->unchecked_context(), "(context)"); + TagObject(js_fun->context(), "(context)"); SetInternalReference(js_fun, entry, - "context", js_fun->unchecked_context(), + "context", js_fun->context(), JSFunction::kContextOffset); for (int i = JSFunction::kNonWeakFieldsEndOffset; i < JSFunction::kSize; diff --git a/src/mark-compact.cc b/src/mark-compact.cc index 54f1396..b7054e4 100644 --- a/src/mark-compact.cc +++ b/src/mark-compact.cc @@ -1319,7 +1319,7 @@ static inline HeapObject* ShortCircuitConsString(Object** p) { InstanceType type = map->instance_type(); if ((type & kShortcutTypeMask) != kShortcutTypeTag) return object; - Object* second = reinterpret_cast(object)->unchecked_second(); + Object* second = reinterpret_cast(object)->second(); Heap* heap = map->GetHeap(); if (second != heap->empty_string()) { return object; @@ -1328,7 +1328,7 @@ static inline HeapObject* ShortCircuitConsString(Object** p) { // Since we don't have the object's start, it is impossible to update the // page dirty marks. Therefore, we only replace the string with its left // substring when page dirty marks do not change. - Object* first = reinterpret_cast(object)->unchecked_first(); + Object* first = reinterpret_cast(object)->first(); if (!heap->InNewSpace(object) && heap->InNewSpace(first)) return object; *p = first; diff --git a/src/objects-inl.h b/src/objects-inl.h index f3d2a66..38de6ef 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -4901,12 +4901,7 @@ bool JSFunction::IsInRecompileQueue() { Code* JSFunction::code() { - return Code::cast(unchecked_code()); -} - - -Code* JSFunction::unchecked_code() { - return reinterpret_cast( + return Code::cast( Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); } @@ -4951,11 +4946,6 @@ Context* JSFunction::context() { } -Object* JSFunction::unchecked_context() { - return READ_FIELD(this, kContextOffset); -} - - void JSFunction::set_context(Object* value) { ASSERT(value->IsUndefined() || value->IsContext()); WRITE_FIELD(this, kContextOffset, value); diff --git a/src/objects-printer.cc b/src/objects-printer.cc index 998bdb6..f1616da 100644 --- a/src/objects-printer.cc +++ b/src/objects-printer.cc @@ -864,7 +864,7 @@ void JSFunction::JSFunctionPrint(FILE* out) { PrintF(out, "\n - name = "); shared()->name()->Print(out); PrintF(out, "\n - context = "); - unchecked_context()->ShortPrint(out); + context()->ShortPrint(out); PrintF(out, "\n - literals = "); literals()->ShortPrint(out); PrintF(out, "\n - code = "); diff --git a/src/objects-visiting-inl.h b/src/objects-visiting-inl.h index 46ca0b1..e0f6b2d 100644 --- a/src/objects-visiting-inl.h +++ b/src/objects-visiting-inl.h @@ -645,7 +645,7 @@ bool StaticMarkingVisitor::IsFlushable( } // The function must have a valid context and not be a builtin. - if (!IsValidNonBuiltinContext(function->unchecked_context())) { + if (!IsValidNonBuiltinContext(function->context())) { return false; } diff --git a/src/objects.h b/src/objects.h index d3abed1..225c740 100644 --- a/src/objects.h +++ b/src/objects.h @@ -6567,7 +6567,6 @@ class JSFunction: public JSObject { // [context]: The context for this function. inline Context* context(); - inline Object* unchecked_context(); inline void set_context(Object* context); // [code]: The generated code object for this function. Executed @@ -6579,8 +6578,6 @@ class JSFunction: public JSObject { inline void set_code_no_write_barrier(Code* code); inline void ReplaceCode(Code* code); - inline Code* unchecked_code(); - // Tells whether this function is builtin. inline bool IsBuiltin(); diff --git a/src/string-stream.cc b/src/string-stream.cc index 1096225..9c4394e 100644 --- a/src/string-stream.cc +++ b/src/string-stream.cc @@ -471,7 +471,7 @@ void StringStream::PrintSecurityTokenIfChanged(Object* f) { } JSFunction* fun = JSFunction::cast(f); - Object* perhaps_context = fun->unchecked_context(); + Object* perhaps_context = fun->context(); if (perhaps_context->IsHeapObject() && heap->Contains(HeapObject::cast(perhaps_context)) && perhaps_context->IsContext()) { -- 2.7.4