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

Side by Side Diff: src/objects.h

Issue 101733002: Fixed global object leak (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ASSERT that Global is not called after detaching the global object Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 7400 matching lines...) Expand 10 before | Expand all | Expand 10 after
7411 7411
7412 class JSGlobalProxy : public JSObject { 7412 class JSGlobalProxy : public JSObject {
7413 public: 7413 public:
7414 // [native_context]: the owner native context of this global proxy object. 7414 // [native_context]: the owner native context of this global proxy object.
7415 // It is null value if this object is not used by any context. 7415 // It is null value if this object is not used by any context.
7416 DECL_ACCESSORS(native_context, Object) 7416 DECL_ACCESSORS(native_context, Object)
7417 7417
7418 // Casting. 7418 // Casting.
7419 static inline JSGlobalProxy* cast(Object* obj); 7419 static inline JSGlobalProxy* cast(Object* obj);
7420 7420
7421 bool IsDetached() { return GetPrototype()->IsNull(); }
7422
7421 // Dispatched behavior. 7423 // Dispatched behavior.
7422 DECLARE_PRINTER(JSGlobalProxy) 7424 DECLARE_PRINTER(JSGlobalProxy)
7423 DECLARE_VERIFIER(JSGlobalProxy) 7425 DECLARE_VERIFIER(JSGlobalProxy)
7424 7426
7425 // Layout description. 7427 // Layout description.
7426 static const int kNativeContextOffset = JSObject::kHeaderSize; 7428 static const int kNativeContextOffset = JSObject::kHeaderSize;
7427 static const int kSize = kNativeContextOffset + kPointerSize; 7429 static const int kSize = kNativeContextOffset + kPointerSize;
7428 7430
7429 private: 7431 private:
7430 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); 7432 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
7480 // JavaScript global object. 7482 // JavaScript global object.
7481 class JSGlobalObject: public GlobalObject { 7483 class JSGlobalObject: public GlobalObject {
7482 public: 7484 public:
7483 // Casting. 7485 // Casting.
7484 static inline JSGlobalObject* cast(Object* obj); 7486 static inline JSGlobalObject* cast(Object* obj);
7485 7487
7486 // Ensure that the global object has a cell for the given property name. 7488 // Ensure that the global object has a cell for the given property name.
7487 static Handle<PropertyCell> EnsurePropertyCell(Handle<JSGlobalObject> global, 7489 static Handle<PropertyCell> EnsurePropertyCell(Handle<JSGlobalObject> global,
7488 Handle<Name> name); 7490 Handle<Name> name);
7489 7491
7492 bool IsDetached() {
7493 return JSGlobalProxy::cast(global_receiver())->IsDetached();
7494 }
7495
7490 // Dispatched behavior. 7496 // Dispatched behavior.
7491 DECLARE_PRINTER(JSGlobalObject) 7497 DECLARE_PRINTER(JSGlobalObject)
7492 DECLARE_VERIFIER(JSGlobalObject) 7498 DECLARE_VERIFIER(JSGlobalObject)
7493 7499
7494 // Layout description. 7500 // Layout description.
7495 static const int kSize = GlobalObject::kHeaderSize; 7501 static const int kSize = GlobalObject::kHeaderSize;
7496 7502
7497 private: 7503 private:
7498 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject); 7504 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject);
7499 }; 7505 };
(...skipping 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after
10612 } else { 10618 } else {
10613 value &= ~(1 << bit_position); 10619 value &= ~(1 << bit_position);
10614 } 10620 }
10615 return value; 10621 return value;
10616 } 10622 }
10617 }; 10623 };
10618 10624
10619 } } // namespace v8::internal 10625 } } // namespace v8::internal
10620 10626
10621 #endif // V8_OBJECTS_H_ 10627 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/runtime.h » ('j') | test/cctest/test-object-observe.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698