Commit b173d2cd authored by yangguo@chromium.org's avatar yangguo@chromium.org

Revert "Handlify GetDeclaredAccessorProperty."

This reverts r20721.

TBR=jarin@chromium.org
BUG=

Review URL: https://codereview.chromium.org/234623004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20731 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 01fc2ab6
...@@ -210,9 +210,9 @@ static inline To* CheckedCast(void *from) { ...@@ -210,9 +210,9 @@ static inline To* CheckedCast(void *from) {
} }
static Handle<Object> PerformCompare(const BitmaskCompareDescriptor& descriptor, static MaybeObject* PerformCompare(const BitmaskCompareDescriptor& descriptor,
char* ptr, char* ptr,
Isolate* isolate) { Heap* heap) {
uint32_t bitmask = descriptor.bitmask; uint32_t bitmask = descriptor.bitmask;
uint32_t compare_value = descriptor.compare_value; uint32_t compare_value = descriptor.compare_value;
uint32_t value; uint32_t value;
...@@ -232,27 +232,26 @@ static Handle<Object> PerformCompare(const BitmaskCompareDescriptor& descriptor, ...@@ -232,27 +232,26 @@ static Handle<Object> PerformCompare(const BitmaskCompareDescriptor& descriptor,
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
return isolate->factory()->undefined_value(); return NULL;
} }
return isolate->factory()->ToBoolean( return heap->ToBoolean((bitmask & value) == (bitmask & compare_value));
(bitmask & value) == (bitmask & compare_value));
} }
static Handle<Object> PerformCompare(const PointerCompareDescriptor& descriptor, static MaybeObject* PerformCompare(const PointerCompareDescriptor& descriptor,
char* ptr, char* ptr,
Isolate* isolate) { Heap* heap) {
uintptr_t compare_value = uintptr_t compare_value =
reinterpret_cast<uintptr_t>(descriptor.compare_value); reinterpret_cast<uintptr_t>(descriptor.compare_value);
uintptr_t value = *CheckedCast<uintptr_t>(ptr); uintptr_t value = *CheckedCast<uintptr_t>(ptr);
return isolate->factory()->ToBoolean(compare_value == value); return heap->ToBoolean(compare_value == value);
} }
static Handle<Object> GetPrimitiveValue( static MaybeObject* GetPrimitiveValue(
const PrimitiveValueDescriptor& descriptor, const PrimitiveValueDescriptor& descriptor,
char* ptr, char* ptr,
Isolate* isolate) { Heap* heap) {
int32_t int32_value = 0; int32_t int32_value = 0;
switch (descriptor.data_type) { switch (descriptor.data_type) {
case kDescriptorInt8Type: case kDescriptorInt8Type:
...@@ -272,36 +271,29 @@ static Handle<Object> GetPrimitiveValue( ...@@ -272,36 +271,29 @@ static Handle<Object> GetPrimitiveValue(
break; break;
case kDescriptorUint32Type: { case kDescriptorUint32Type: {
uint32_t value = *CheckedCast<uint32_t>(ptr); uint32_t value = *CheckedCast<uint32_t>(ptr);
AllowHeapAllocation allow_gc; return heap->NumberFromUint32(value);
return isolate->factory()->NewNumberFromUint(value);
} }
case kDescriptorBoolType: { case kDescriptorBoolType: {
uint8_t byte = *CheckedCast<uint8_t>(ptr); uint8_t byte = *CheckedCast<uint8_t>(ptr);
return isolate->factory()->ToBoolean( return heap->ToBoolean(byte & (0x1 << descriptor.bool_offset));
byte & (0x1 << descriptor.bool_offset));
} }
case kDescriptorFloatType: { case kDescriptorFloatType: {
float value = *CheckedCast<float>(ptr); float value = *CheckedCast<float>(ptr);
AllowHeapAllocation allow_gc; return heap->NumberFromDouble(value);
return isolate->factory()->NewNumber(value);
} }
case kDescriptorDoubleType: { case kDescriptorDoubleType: {
double value = *CheckedCast<double>(ptr); double value = *CheckedCast<double>(ptr);
AllowHeapAllocation allow_gc; return heap->NumberFromDouble(value);
return isolate->factory()->NewNumber(value);
} }
} }
AllowHeapAllocation allow_gc; return heap->NumberFromInt32(int32_value);
return isolate->factory()->NewNumberFromInt(int32_value);
} }
static Handle<Object> GetDeclaredAccessorProperty( static MaybeObject* GetDeclaredAccessorProperty(Object* receiver,
Handle<Object> receiver, DeclaredAccessorInfo* info,
Handle<DeclaredAccessorInfo> info, Isolate* isolate) {
Isolate* isolate) { char* current = reinterpret_cast<char*>(receiver);
DisallowHeapAllocation no_gc;
char* current = reinterpret_cast<char*>(*receiver);
DeclaredAccessorDescriptorIterator iterator(info->descriptor()); DeclaredAccessorDescriptorIterator iterator(info->descriptor());
while (true) { while (true) {
const DeclaredAccessorDescriptorData* data = iterator.Next(); const DeclaredAccessorDescriptorData* data = iterator.Next();
...@@ -309,7 +301,7 @@ static Handle<Object> GetDeclaredAccessorProperty( ...@@ -309,7 +301,7 @@ static Handle<Object> GetDeclaredAccessorProperty(
case kDescriptorReturnObject: { case kDescriptorReturnObject: {
ASSERT(iterator.Complete()); ASSERT(iterator.Complete());
current = *CheckedCast<char*>(current); current = *CheckedCast<char*>(current);
return handle(*CheckedCast<Object*>(current), isolate); return *CheckedCast<Object*>(current);
} }
case kDescriptorPointerDereference: case kDescriptorPointerDereference:
ASSERT(!iterator.Complete()); ASSERT(!iterator.Complete());
...@@ -332,21 +324,31 @@ static Handle<Object> GetDeclaredAccessorProperty( ...@@ -332,21 +324,31 @@ static Handle<Object> GetDeclaredAccessorProperty(
ASSERT(iterator.Complete()); ASSERT(iterator.Complete());
return PerformCompare(data->bitmask_compare_descriptor, return PerformCompare(data->bitmask_compare_descriptor,
current, current,
isolate); isolate->heap());
case kDescriptorPointerCompare: case kDescriptorPointerCompare:
ASSERT(iterator.Complete()); ASSERT(iterator.Complete());
return PerformCompare(data->pointer_compare_descriptor, return PerformCompare(data->pointer_compare_descriptor,
current, current,
isolate); isolate->heap());
case kDescriptorPrimitiveValue: case kDescriptorPrimitiveValue:
ASSERT(iterator.Complete()); ASSERT(iterator.Complete());
return GetPrimitiveValue(data->primitive_value_descriptor, return GetPrimitiveValue(data->primitive_value_descriptor,
current, current,
isolate); isolate->heap());
} }
} }
UNREACHABLE(); UNREACHABLE();
return isolate->factory()->undefined_value(); return NULL;
}
static Handle<Object> GetDeclaredAccessorProperty(
Handle<Object> receiver,
Handle<DeclaredAccessorInfo> info,
Isolate* isolate) {
CALL_HEAP_FUNCTION(isolate,
GetDeclaredAccessorProperty(*receiver, *info, isolate),
Object);
} }
...@@ -390,10 +392,12 @@ MaybeHandle<Object> JSObject::GetPropertyWithCallback(Handle<JSObject> object, ...@@ -390,10 +392,12 @@ MaybeHandle<Object> JSObject::GetPropertyWithCallback(Handle<JSObject> object,
// so we do not support it for now. // so we do not support it for now.
if (name->IsSymbol()) return isolate->factory()->undefined_value(); if (name->IsSymbol()) return isolate->factory()->undefined_value();
if (structure->IsDeclaredAccessorInfo()) { if (structure->IsDeclaredAccessorInfo()) {
return GetDeclaredAccessorProperty( CALL_HEAP_FUNCTION(
receiver, isolate,
Handle<DeclaredAccessorInfo>::cast(structure), GetDeclaredAccessorProperty(*receiver,
isolate); DeclaredAccessorInfo::cast(*structure),
isolate),
Object);
} }
Handle<ExecutableAccessorInfo> data = Handle<ExecutableAccessorInfo> data =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment