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

Unified Diff: src/accessors.h

Issue 152863002: Use Type* in crankshaft rather than HeapType. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/accessors.cc » ('j') | src/hydrogen.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/accessors.h
diff --git a/src/accessors.h b/src/accessors.h
index dedde32ef92567dca47db5e2e413b430a1d8c1b3..a4e4096fc36919b08337cf79a0ad24ae3505a7e1 100644
--- a/src/accessors.h
+++ b/src/accessors.h
@@ -29,6 +29,7 @@
#define V8_ACCESSORS_H_
#include "allocation.h"
+#include "types.h"
#include "v8globals.h"
namespace v8 {
@@ -86,11 +87,64 @@ class Accessors : public AllStatic {
static Handle<AccessorInfo> MakeModuleExport(
Handle<String> name, int index, PropertyAttributes attributes);
+ static V8_INLINE bool CheckForName(Handle<String> name,
+ String* property_name,
+ int offset,
+ int* object_offset) {
+ if (name->Equals(property_name)) {
+ *object_offset = offset;
+ return true;
+ }
+ return false;
+ }
+
// Returns true for properties that are accessors to object fields.
// If true, *object_offset contains offset of object field.
- static bool IsJSObjectFieldAccessor(
- Handle<HeapType> map, Handle<String> name, int* object_offset);
+ template <class T>
rossberg 2014/02/03 16:54:05 You don't necessarily need to move this to the hea
+ static bool IsJSObjectFieldAccessor(typename T::TypeHandle type,
+ Handle<String> name,
+ int* object_offset) {
+ Isolate* isolate = name->GetIsolate();
+
+ if (type->Is(T::String())) {
+ return CheckForName(name, isolate->heap()->length_string(),
+ String::kLengthOffset, object_offset);
+ }
+
+ if (!type->IsClass()) return false;
+ Handle<Map> map = type->AsClass();
+ switch (map->instance_type()) {
+ case JS_ARRAY_TYPE:
+ return
+ CheckForName(name, isolate->heap()->length_string(),
+ JSArray::kLengthOffset, object_offset);
+ case JS_TYPED_ARRAY_TYPE:
+ return
+ CheckForName(name, isolate->heap()->length_string(),
+ JSTypedArray::kLengthOffset, object_offset) ||
+ CheckForName(name, isolate->heap()->byte_length_string(),
+ JSTypedArray::kByteLengthOffset, object_offset) ||
+ CheckForName(name, isolate->heap()->byte_offset_string(),
+ JSTypedArray::kByteOffsetOffset, object_offset) ||
+ CheckForName(name, isolate->heap()->buffer_string(),
+ JSTypedArray::kBufferOffset, object_offset);
+ case JS_ARRAY_BUFFER_TYPE:
+ return
+ CheckForName(name, isolate->heap()->byte_length_string(),
+ JSArrayBuffer::kByteLengthOffset, object_offset);
+ case JS_DATA_VIEW_TYPE:
+ return
+ CheckForName(name, isolate->heap()->byte_length_string(),
+ JSDataView::kByteLengthOffset, object_offset) ||
+ CheckForName(name, isolate->heap()->byte_offset_string(),
+ JSDataView::kByteOffsetOffset, object_offset) ||
+ CheckForName(name, isolate->heap()->buffer_string(),
+ JSDataView::kBufferOffset, object_offset);
+ default:
+ return false;
+ }
+ }
private:
// Accessor functions only used through the descriptor.
« no previous file with comments | « no previous file | src/accessors.cc » ('j') | src/hydrogen.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698