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

Side by Side Diff: src/runtime.cc

Issue 233233004: Handlify GetProperty. (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 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 6039 matching lines...) Expand 10 before | Expand all | Expand 10 after
6050 // Try to convert the key to an index. If successful and within 6050 // Try to convert the key to an index. If successful and within
6051 // index return the the argument from the frame. 6051 // index return the the argument from the frame.
6052 uint32_t index; 6052 uint32_t index;
6053 if (args[0]->ToArrayIndex(&index) && index < n) { 6053 if (args[0]->ToArrayIndex(&index) && index < n) {
6054 return frame->GetParameter(index); 6054 return frame->GetParameter(index);
6055 } 6055 }
6056 6056
6057 HandleScope scope(isolate); 6057 HandleScope scope(isolate);
6058 if (args[0]->IsSymbol()) { 6058 if (args[0]->IsSymbol()) {
6059 // Lookup in the initial Object.prototype object. 6059 // Lookup in the initial Object.prototype object.
6060 Handle<Object> result = Object::GetProperty( 6060 Handle<Object> result;
6061 isolate->initial_object_prototype(), args.at<Symbol>(0)); 6061 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
6062 RETURN_IF_EMPTY_HANDLE(isolate, result); 6062 isolate, result,
6063 Object::GetProperty(
6064 isolate->initial_object_prototype(), args.at<Symbol>(0)));
6063 return *result; 6065 return *result;
6064 } 6066 }
6065 6067
6066 // Convert the key to a string. 6068 // Convert the key to a string.
6067 bool exception = false; 6069 bool exception = false;
6068 Handle<Object> converted = 6070 Handle<Object> converted =
6069 Execution::ToString(isolate, args.at<Object>(0), &exception); 6071 Execution::ToString(isolate, args.at<Object>(0), &exception);
6070 if (exception) return Failure::Exception(); 6072 if (exception) return Failure::Exception();
6071 Handle<String> key = Handle<String>::cast(converted); 6073 Handle<String> key = Handle<String>::cast(converted);
6072 6074
(...skipping 16 matching lines...) Expand all
6089 if (key->Equals(isolate->heap()->callee_string())) { 6091 if (key->Equals(isolate->heap()->callee_string())) {
6090 JSFunction* function = frame->function(); 6092 JSFunction* function = frame->function();
6091 if (function->shared()->strict_mode() == STRICT) { 6093 if (function->shared()->strict_mode() == STRICT) {
6092 return isolate->Throw(*isolate->factory()->NewTypeError( 6094 return isolate->Throw(*isolate->factory()->NewTypeError(
6093 "strict_arguments_callee", HandleVector<Object>(NULL, 0))); 6095 "strict_arguments_callee", HandleVector<Object>(NULL, 0)));
6094 } 6096 }
6095 return function; 6097 return function;
6096 } 6098 }
6097 6099
6098 // Lookup in the initial Object.prototype object. 6100 // Lookup in the initial Object.prototype object.
6099 Handle<Object> result = Object::GetProperty( 6101 Handle<Object> result;
6100 isolate->initial_object_prototype(), key); 6102 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
6101 RETURN_IF_EMPTY_HANDLE(isolate, result); 6103 isolate, result,
6104 Object::GetProperty(isolate->initial_object_prototype(), key));
6102 return *result; 6105 return *result;
6103 } 6106 }
6104 6107
6105 6108
6106 RUNTIME_FUNCTION(MaybeObject*, Runtime_ToFastProperties) { 6109 RUNTIME_FUNCTION(MaybeObject*, Runtime_ToFastProperties) {
6107 HandleScope scope(isolate); 6110 HandleScope scope(isolate);
6108 ASSERT(args.length() == 1); 6111 ASSERT(args.length() == 1);
6109 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 6112 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
6110 if (object->IsJSObject() && !object->IsGlobalObject()) { 6113 if (object->IsJSObject() && !object->IsGlobalObject()) {
6111 JSObject::TransformToFastProperties(Handle<JSObject>::cast(object), 0); 6114 JSObject::TransformToFastProperties(Handle<JSObject>::cast(object), 0);
(...skipping 3224 matching lines...) Expand 10 before | Expand all | Expand 10 after
9336 // GetProperty below can cause GC. 9339 // GetProperty below can cause GC.
9337 Handle<Object> receiver_handle( 9340 Handle<Object> receiver_handle(
9338 object->IsGlobalObject() 9341 object->IsGlobalObject()
9339 ? Object::cast(isolate->heap()->undefined_value()) 9342 ? Object::cast(isolate->heap()->undefined_value())
9340 : object->IsJSProxy() ? static_cast<Object*>(*object) 9343 : object->IsJSProxy() ? static_cast<Object*>(*object)
9341 : ComputeReceiverForNonGlobal(isolate, JSObject::cast(*object)), 9344 : ComputeReceiverForNonGlobal(isolate, JSObject::cast(*object)),
9342 isolate); 9345 isolate);
9343 9346
9344 // No need to unhole the value here. This is taken care of by the 9347 // No need to unhole the value here. This is taken care of by the
9345 // GetProperty function. 9348 // GetProperty function.
9346 Handle<Object> value = Object::GetProperty(object, name); 9349 Handle<Object> value;
9347 RETURN_IF_EMPTY_HANDLE_VALUE( 9350 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
9348 isolate, value, MakePair(Failure::Exception(), NULL)); 9351 isolate, value,
9352 Object::GetProperty(object, name),
9353 MakePair(Failure::Exception(), NULL));
9349 return MakePair(*value, *receiver_handle); 9354 return MakePair(*value, *receiver_handle);
9350 } 9355 }
9351 9356
9352 if (throw_error) { 9357 if (throw_error) {
9353 // The property doesn't exist - throw exception. 9358 // The property doesn't exist - throw exception.
9354 Handle<Object> reference_error = 9359 Handle<Object> reference_error =
9355 isolate->factory()->NewReferenceError("not_defined", 9360 isolate->factory()->NewReferenceError("not_defined",
9356 HandleVector(&name, 1)); 9361 HandleVector(&name, 1));
9357 return MakePair(isolate->Throw(*reference_error), NULL); 9362 return MakePair(isolate->Throw(*reference_error), NULL);
9358 } else { 9363 } else {
(...skipping 5879 matching lines...) Expand 10 before | Expand all | Expand 10 after
15238 } 15243 }
15239 } 15244 }
15240 15245
15241 15246
15242 void Runtime::OutOfMemory() { 15247 void Runtime::OutOfMemory() {
15243 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15248 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15244 UNREACHABLE(); 15249 UNREACHABLE();
15245 } 15250 }
15246 15251
15247 } } // namespace v8::internal 15252 } } // namespace v8::internal
OLDNEW
« src/objects.cc ('K') | « src/objects-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698