Reviewers: Hannes Payer,

Description:
Remove obsolete unchecked accessors in JSFunction.

[email protected]
BUG=v8:1490

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

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

Affected files:
  M src/frames.cc
  M src/heap-snapshot-generator.cc
  M src/mark-compact.cc
  M src/objects-inl.h
  M src/objects-printer.cc
  M src/objects-visiting-inl.h
  M src/objects.h
  M src/string-stream.cc


Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index 80fe469d2c51d3921cb5e108c2d596afb37880ec..49a08ad61480b2aa37660d720699cfd23e1c74f8 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();
 }


Index: src/heap-snapshot-generator.cc
diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc
index 217d1ca25ecfa9dae22b7270b973700c67a2a09f..fc18c0fe8bb1f8c58fb283b1ae9fed00b8984861 100644
--- a/src/heap-snapshot-generator.cc
+++ b/src/heap-snapshot-generator.cc
@@ -1048,9 +1048,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;
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 54f1396d2c757c36aa9e5965919eca7fc5e5ed47..b7054e43a646cc0486b120324b715635c621acc6 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<ConsString*>(object)->unchecked_second();
+  Object* second = reinterpret_cast<ConsString*>(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<ConsString*>(object)->unchecked_first();
+  Object* first = reinterpret_cast<ConsString*>(object)->first();
   if (!heap->InNewSpace(object) && heap->InNewSpace(first)) return object;

   *p = first;
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 27a626779cfdd24cb22744967cde1076de9e91a7..70c9600332023e967da037579e391319c2a7507c 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<Code*>(
+  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);
Index: src/objects-printer.cc
diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index 998bdb6c900c1f9db5e22cebe98ff71c21c55b92..f1616da1aac55e51025b6dce8c3d59132b2c911b 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 = ");
Index: src/objects-visiting-inl.h
diff --git a/src/objects-visiting-inl.h b/src/objects-visiting-inl.h
index 46ca0b10ca6219d9b49e8fe08d20241cad400087..e0f6b2d2f5fcede79cd72c3717c79d0093c8a44a 100644
--- a/src/objects-visiting-inl.h
+++ b/src/objects-visiting-inl.h
@@ -645,7 +645,7 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
   }

   // The function must have a valid context and not be a builtin.
-  if (!IsValidNonBuiltinContext(function->unchecked_context())) {
+  if (!IsValidNonBuiltinContext(function->context())) {
     return false;
   }

Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index a758ff37d78bfa1f801e56126edfdf1999063c0e..78b0a783195213e34a5f021f54bc00739b9fa6c5 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();

Index: src/string-stream.cc
diff --git a/src/string-stream.cc b/src/string-stream.cc
index 109622567aca808d0e0dce38a1acd8c61b46868c..9c4394ed7f01d1e3e3f1b405a616e1701664433a 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()) {


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to