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

Side by Side Diff: src/runtime.cc

Issue 235083002: Reland "Handlify GetProperty." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix 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
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6029 matching lines...) Expand 10 before | Expand all | Expand 10 after
6040 // Try to convert the key to an index. If successful and within 6040 // Try to convert the key to an index. If successful and within
6041 // index return the the argument from the frame. 6041 // index return the the argument from the frame.
6042 uint32_t index; 6042 uint32_t index;
6043 if (args[0]->ToArrayIndex(&index) && index < n) { 6043 if (args[0]->ToArrayIndex(&index) && index < n) {
6044 return frame->GetParameter(index); 6044 return frame->GetParameter(index);
6045 } 6045 }
6046 6046
6047 HandleScope scope(isolate); 6047 HandleScope scope(isolate);
6048 if (args[0]->IsSymbol()) { 6048 if (args[0]->IsSymbol()) {
6049 // Lookup in the initial Object.prototype object. 6049 // Lookup in the initial Object.prototype object.
6050 Handle<Object> result = Object::GetProperty( 6050 Handle<Object> result;
6051 isolate->initial_object_prototype(), args.at<Symbol>(0)); 6051 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
6052 RETURN_IF_EMPTY_HANDLE(isolate, result); 6052 isolate, result,
6053 Object::GetProperty(
6054 isolate->initial_object_prototype(), args.at<Symbol>(0)));
6053 return *result; 6055 return *result;
6054 } 6056 }
6055 6057
6056 // Convert the key to a string. 6058 // Convert the key to a string.
6057 Handle<Object> converted; 6059 Handle<Object> converted;
6058 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 6060 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
6059 isolate, converted, Execution::ToString(isolate, args.at<Object>(0))); 6061 isolate, converted, Execution::ToString(isolate, args.at<Object>(0)));
6060 Handle<String> key = Handle<String>::cast(converted); 6062 Handle<String> key = Handle<String>::cast(converted);
6061 6063
6062 // Try to convert the string key into an array index. 6064 // Try to convert the string key into an array index.
(...skipping 17 matching lines...) Expand all
6080 if (String::Equals(isolate->factory()->callee_string(), key)) { 6082 if (String::Equals(isolate->factory()->callee_string(), key)) {
6081 JSFunction* function = frame->function(); 6083 JSFunction* function = frame->function();
6082 if (function->shared()->strict_mode() == STRICT) { 6084 if (function->shared()->strict_mode() == STRICT) {
6083 return isolate->Throw(*isolate->factory()->NewTypeError( 6085 return isolate->Throw(*isolate->factory()->NewTypeError(
6084 "strict_arguments_callee", HandleVector<Object>(NULL, 0))); 6086 "strict_arguments_callee", HandleVector<Object>(NULL, 0)));
6085 } 6087 }
6086 return function; 6088 return function;
6087 } 6089 }
6088 6090
6089 // Lookup in the initial Object.prototype object. 6091 // Lookup in the initial Object.prototype object.
6090 Handle<Object> result = Object::GetProperty( 6092 Handle<Object> result;
6091 isolate->initial_object_prototype(), key); 6093 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
6092 RETURN_IF_EMPTY_HANDLE(isolate, result); 6094 isolate, result,
6095 Object::GetProperty(isolate->initial_object_prototype(), key));
6093 return *result; 6096 return *result;
6094 } 6097 }
6095 6098
6096 6099
6097 RUNTIME_FUNCTION(MaybeObject*, Runtime_ToFastProperties) { 6100 RUNTIME_FUNCTION(MaybeObject*, Runtime_ToFastProperties) {
6098 HandleScope scope(isolate); 6101 HandleScope scope(isolate);
6099 ASSERT(args.length() == 1); 6102 ASSERT(args.length() == 1);
6100 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 6103 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
6101 if (object->IsJSObject() && !object->IsGlobalObject()) { 6104 if (object->IsJSObject() && !object->IsGlobalObject()) {
6102 JSObject::TransformToFastProperties(Handle<JSObject>::cast(object), 0); 6105 JSObject::TransformToFastProperties(Handle<JSObject>::cast(object), 0);
(...skipping 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after
9301 // GetProperty below can cause GC. 9304 // GetProperty below can cause GC.
9302 Handle<Object> receiver_handle( 9305 Handle<Object> receiver_handle(
9303 object->IsGlobalObject() 9306 object->IsGlobalObject()
9304 ? Object::cast(isolate->heap()->undefined_value()) 9307 ? Object::cast(isolate->heap()->undefined_value())
9305 : object->IsJSProxy() ? static_cast<Object*>(*object) 9308 : object->IsJSProxy() ? static_cast<Object*>(*object)
9306 : ComputeReceiverForNonGlobal(isolate, JSObject::cast(*object)), 9309 : ComputeReceiverForNonGlobal(isolate, JSObject::cast(*object)),
9307 isolate); 9310 isolate);
9308 9311
9309 // No need to unhole the value here. This is taken care of by the 9312 // No need to unhole the value here. This is taken care of by the
9310 // GetProperty function. 9313 // GetProperty function.
9311 Handle<Object> value = Object::GetProperty(object, name); 9314 Handle<Object> value;
9312 RETURN_IF_EMPTY_HANDLE_VALUE( 9315 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
9313 isolate, value, MakePair(Failure::Exception(), NULL)); 9316 isolate, value,
9317 Object::GetProperty(object, name),
9318 MakePair(Failure::Exception(), NULL));
9314 return MakePair(*value, *receiver_handle); 9319 return MakePair(*value, *receiver_handle);
9315 } 9320 }
9316 9321
9317 if (throw_error) { 9322 if (throw_error) {
9318 // The property doesn't exist - throw exception. 9323 // The property doesn't exist - throw exception.
9319 Handle<Object> reference_error = 9324 Handle<Object> reference_error =
9320 isolate->factory()->NewReferenceError("not_defined", 9325 isolate->factory()->NewReferenceError("not_defined",
9321 HandleVector(&name, 1)); 9326 HandleVector(&name, 1));
9322 return MakePair(isolate->Throw(*reference_error), NULL); 9327 return MakePair(isolate->Throw(*reference_error), NULL);
9323 } else { 9328 } else {
(...skipping 5843 matching lines...) Expand 10 before | Expand all | Expand 10 after
15167 } 15172 }
15168 } 15173 }
15169 15174
15170 15175
15171 void Runtime::OutOfMemory() { 15176 void Runtime::OutOfMemory() {
15172 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15177 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15173 UNREACHABLE(); 15178 UNREACHABLE();
15174 } 15179 }
15175 15180
15176 } } // namespace v8::internal 15181 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « 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