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

Unified Diff: src/objects.cc

Issue 236943002: Handlify GetDeclaredAccessorProperty. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 4061f61a8c17b45b89cd2393bbbae3a0810446f5..5a9c77e63865be920d051811b4e4e3ed6bf75f50 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -210,9 +210,9 @@ static inline To* CheckedCast(void *from) {
}
-static MaybeObject* PerformCompare(const BitmaskCompareDescriptor& descriptor,
- char* ptr,
- Heap* heap) {
+static Handle<Object> PerformCompare(const BitmaskCompareDescriptor& descriptor,
+ char* ptr,
+ Isolate* isolate) {
uint32_t bitmask = descriptor.bitmask;
uint32_t compare_value = descriptor.compare_value;
uint32_t value;
@@ -232,26 +232,27 @@ static MaybeObject* PerformCompare(const BitmaskCompareDescriptor& descriptor,
break;
default:
UNREACHABLE();
- return NULL;
+ return isolate->factory()->undefined_value();
}
- return heap->ToBoolean((bitmask & value) == (bitmask & compare_value));
+ return isolate->factory()->ToBoolean(
+ (bitmask & value) == (bitmask & compare_value));
}
-static MaybeObject* PerformCompare(const PointerCompareDescriptor& descriptor,
- char* ptr,
- Heap* heap) {
+static Handle<Object> PerformCompare(const PointerCompareDescriptor& descriptor,
+ char* ptr,
+ Isolate* isolate) {
uintptr_t compare_value =
reinterpret_cast<uintptr_t>(descriptor.compare_value);
uintptr_t value = *CheckedCast<uintptr_t>(ptr);
- return heap->ToBoolean(compare_value == value);
+ return isolate->factory()->ToBoolean(compare_value == value);
}
-static MaybeObject* GetPrimitiveValue(
+static Handle<Object> GetPrimitiveValue(
const PrimitiveValueDescriptor& descriptor,
char* ptr,
- Heap* heap) {
+ Isolate* isolate) {
int32_t int32_value = 0;
switch (descriptor.data_type) {
case kDescriptorInt8Type:
@@ -271,29 +272,36 @@ static MaybeObject* GetPrimitiveValue(
break;
case kDescriptorUint32Type: {
uint32_t value = *CheckedCast<uint32_t>(ptr);
- return heap->NumberFromUint32(value);
+ AllowHeapAllocation allow_gc;
+ return isolate->factory()->NewNumberFromUint(value);
}
case kDescriptorBoolType: {
uint8_t byte = *CheckedCast<uint8_t>(ptr);
- return heap->ToBoolean(byte & (0x1 << descriptor.bool_offset));
+ return isolate->factory()->ToBoolean(
+ byte & (0x1 << descriptor.bool_offset));
}
case kDescriptorFloatType: {
float value = *CheckedCast<float>(ptr);
- return heap->NumberFromDouble(value);
+ AllowHeapAllocation allow_gc;
+ return isolate->factory()->NewNumber(value);
}
case kDescriptorDoubleType: {
double value = *CheckedCast<double>(ptr);
- return heap->NumberFromDouble(value);
+ AllowHeapAllocation allow_gc;
+ return isolate->factory()->NewNumber(value);
}
}
- return heap->NumberFromInt32(int32_value);
+ AllowHeapAllocation allow_gc;
+ return isolate->factory()->NewNumberFromInt(int32_value);
}
-static MaybeObject* GetDeclaredAccessorProperty(Object* receiver,
- DeclaredAccessorInfo* info,
- Isolate* isolate) {
- char* current = reinterpret_cast<char*>(receiver);
+static Handle<Object> GetDeclaredAccessorProperty(
+ Handle<Object> receiver,
+ Handle<DeclaredAccessorInfo> info,
+ Isolate* isolate) {
+ DisallowHeapAllocation no_gc;
+ char* current = reinterpret_cast<char*>(*receiver);
DeclaredAccessorDescriptorIterator iterator(info->descriptor());
while (true) {
const DeclaredAccessorDescriptorData* data = iterator.Next();
@@ -301,7 +309,7 @@ static MaybeObject* GetDeclaredAccessorProperty(Object* receiver,
case kDescriptorReturnObject: {
ASSERT(iterator.Complete());
current = *CheckedCast<char*>(current);
- return *CheckedCast<Object*>(current);
+ return handle(*CheckedCast<Object*>(current), isolate);
}
case kDescriptorPointerDereference:
ASSERT(!iterator.Complete());
@@ -324,31 +332,21 @@ static MaybeObject* GetDeclaredAccessorProperty(Object* receiver,
ASSERT(iterator.Complete());
return PerformCompare(data->bitmask_compare_descriptor,
current,
- isolate->heap());
+ isolate);
case kDescriptorPointerCompare:
ASSERT(iterator.Complete());
return PerformCompare(data->pointer_compare_descriptor,
current,
- isolate->heap());
+ isolate);
case kDescriptorPrimitiveValue:
ASSERT(iterator.Complete());
return GetPrimitiveValue(data->primitive_value_descriptor,
current,
- isolate->heap());
+ isolate);
}
}
UNREACHABLE();
- return NULL;
-}
-
-
-static Handle<Object> GetDeclaredAccessorProperty(
- Handle<Object> receiver,
- Handle<DeclaredAccessorInfo> info,
- Isolate* isolate) {
- CALL_HEAP_FUNCTION(isolate,
- GetDeclaredAccessorProperty(*receiver, *info, isolate),
- Object);
+ return isolate->factory()->undefined_value();
}
@@ -392,12 +390,10 @@ MaybeHandle<Object> JSObject::GetPropertyWithCallback(Handle<JSObject> object,
// so we do not support it for now.
if (name->IsSymbol()) return isolate->factory()->undefined_value();
if (structure->IsDeclaredAccessorInfo()) {
- CALL_HEAP_FUNCTION(
- isolate,
- GetDeclaredAccessorProperty(*receiver,
- DeclaredAccessorInfo::cast(*structure),
- isolate),
- Object);
+ return GetDeclaredAccessorProperty(
+ receiver,
+ Handle<DeclaredAccessorInfo>::cast(structure),
+ isolate);
}
Handle<ExecutableAccessorInfo> data =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698