Index: src/elements.h |
diff --git a/src/elements.h b/src/elements.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7a3d342448270c8411451e2531a3bcb69925d34a |
--- /dev/null |
+++ b/src/elements.h |
@@ -0,0 +1,61 @@ |
+// Copyright 2011 the V8 project authors. All rights reserved. |
+// Redistribution and use in source and binary forms, with or without |
+// modification, are permitted provided that the following conditions are |
+// met: |
+// |
+// * Redistributions of source code must retain the above copyright |
+// notice, this list of conditions and the following disclaimer. |
+// * Redistributions in binary form must reproduce the above |
+// copyright notice, this list of conditions and the following |
+// disclaimer in the documentation and/or other materials provided |
+// with the distribution. |
+// * Neither the name of Google Inc. nor the names of its |
+// contributors may be used to endorse or promote products derived |
+// from this software without specific prior written permission. |
+// |
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ |
+#ifndef V8_ELEMENTS_H_ |
+#define V8_ELEMENTS_H_ |
+ |
+#include "objects.h" |
+ |
+namespace v8 { |
+namespace internal { |
+ |
+// Abstract base class for handles that can operate on object with differing |
Rico
2011/08/01 07:33:27
on object -> an object or objects
danno
2011/08/02 13:37:46
Done.
|
+// ElementsKinds. |
+class ElementsHandler { |
Lasse Reichstein
2011/08/01 09:35:54
What does "Handler" mean. Seems too generic to be
danno
2011/08/02 13:37:46
My plan is to have this class house all of the ele
|
+ public: |
+ ElementsHandler() { } |
+ virtual ~ElementsHandler() { } |
+ virtual bool GetWithReceiver(JSObject* obj, |
+ Object* receiver, |
+ uint32_t index, |
+ MaybeObject** result) = 0; |
+ |
+ // Returns a shared ElementsHandler for the specified ElementsKind. |
+ inline static ElementsHandler* ForKind(JSObject::ElementsKind elements_kind) { |
Kevin Millikin (Chromium)
2011/08/01 10:18:23
No need for 'inline'. Maybe the function name/sig
Lasse Reichstein
2011/08/01 10:47:13
We should probably not call it anything with "Sing
danno
2011/08/02 13:37:46
Done.
danno
2011/08/02 13:37:46
singleton is not quite right, and I actually like
|
+ ASSERT(elements_kind < JSObject::kElementsKindCount); |
+ return elements_handler_table_[elements_kind]; |
+ } |
+ |
+ private: |
+ static ElementsHandler* elements_handler_table_[]; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ElementsHandler); |
+}; |
+ |
+} } // namespace v8::internal |
+ |
+#endif // V8_ELEMENTS_H_ |