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

Side by Side Diff: src/runtime.cc

Issue 229973004: Remove calls to non-handlified version of GetProperty(name). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: update 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-compiler.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 6027 matching lines...) Expand 10 before | Expand all | Expand 10 after
6038 // Get the actual number of provided arguments. 6038 // Get the actual number of provided arguments.
6039 const uint32_t n = frame->ComputeParametersCount(); 6039 const uint32_t n = frame->ComputeParametersCount();
6040 6040
6041 // Try to convert the key to an index. If successful and within 6041 // Try to convert the key to an index. If successful and within
6042 // index return the the argument from the frame. 6042 // index return the the argument from the frame.
6043 uint32_t index; 6043 uint32_t index;
6044 if (args[0]->ToArrayIndex(&index) && index < n) { 6044 if (args[0]->ToArrayIndex(&index) && index < n) {
6045 return frame->GetParameter(index); 6045 return frame->GetParameter(index);
6046 } 6046 }
6047 6047
6048 HandleScope scope(isolate);
6048 if (args[0]->IsSymbol()) { 6049 if (args[0]->IsSymbol()) {
6049 // Lookup in the initial Object.prototype object. 6050 // Lookup in the initial Object.prototype object.
6050 return isolate->initial_object_prototype()->GetProperty( 6051 Handle<Object> result = Object::GetProperty(
6051 Symbol::cast(args[0])); 6052 isolate->initial_object_prototype(), args.at<Symbol>(0));
6053 RETURN_IF_EMPTY_HANDLE(isolate, result);
6054 return *result;
6052 } 6055 }
6053 6056
6054 // Convert the key to a string. 6057 // Convert the key to a string.
6055 HandleScope scope(isolate);
6056 bool exception = false; 6058 bool exception = false;
6057 Handle<Object> converted = 6059 Handle<Object> converted =
6058 Execution::ToString(isolate, args.at<Object>(0), &exception); 6060 Execution::ToString(isolate, args.at<Object>(0), &exception);
6059 if (exception) return Failure::Exception(); 6061 if (exception) return Failure::Exception();
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.
6063 if (key->AsArrayIndex(&index)) { 6065 if (key->AsArrayIndex(&index)) {
6064 if (index < n) { 6066 if (index < n) {
6065 return frame->GetParameter(index); 6067 return frame->GetParameter(index);
(...skipping 11 matching lines...) Expand all
6077 if (key->Equals(isolate->heap()->callee_string())) { 6079 if (key->Equals(isolate->heap()->callee_string())) {
6078 JSFunction* function = frame->function(); 6080 JSFunction* function = frame->function();
6079 if (function->shared()->strict_mode() == STRICT) { 6081 if (function->shared()->strict_mode() == STRICT) {
6080 return isolate->Throw(*isolate->factory()->NewTypeError( 6082 return isolate->Throw(*isolate->factory()->NewTypeError(
6081 "strict_arguments_callee", HandleVector<Object>(NULL, 0))); 6083 "strict_arguments_callee", HandleVector<Object>(NULL, 0)));
6082 } 6084 }
6083 return function; 6085 return function;
6084 } 6086 }
6085 6087
6086 // Lookup in the initial Object.prototype object. 6088 // Lookup in the initial Object.prototype object.
6087 return isolate->initial_object_prototype()->GetProperty(*key); 6089 Handle<Object> result = Object::GetProperty(
6090 isolate->initial_object_prototype(), key);
6091 RETURN_IF_EMPTY_HANDLE(isolate, result);
6092 return *result;
6088 } 6093 }
6089 6094
6090 6095
6091 RUNTIME_FUNCTION(MaybeObject*, Runtime_ToFastProperties) { 6096 RUNTIME_FUNCTION(MaybeObject*, Runtime_ToFastProperties) {
6092 HandleScope scope(isolate); 6097 HandleScope scope(isolate);
6093 ASSERT(args.length() == 1); 6098 ASSERT(args.length() == 1);
6094 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 6099 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
6095 if (object->IsJSObject() && !object->IsGlobalObject()) { 6100 if (object->IsJSObject() && !object->IsGlobalObject()) {
6096 JSObject::TransformToFastProperties(Handle<JSObject>::cast(object), 0); 6101 JSObject::TransformToFastProperties(Handle<JSObject>::cast(object), 0);
6097 } 6102 }
(...skipping 3237 matching lines...) Expand 10 before | Expand all | Expand 10 after
9335 // GetProperty below can cause GC. 9340 // GetProperty below can cause GC.
9336 Handle<Object> receiver_handle( 9341 Handle<Object> receiver_handle(
9337 object->IsGlobalObject() 9342 object->IsGlobalObject()
9338 ? Object::cast(isolate->heap()->undefined_value()) 9343 ? Object::cast(isolate->heap()->undefined_value())
9339 : object->IsJSProxy() ? static_cast<Object*>(*object) 9344 : object->IsJSProxy() ? static_cast<Object*>(*object)
9340 : ComputeReceiverForNonGlobal(isolate, JSObject::cast(*object)), 9345 : ComputeReceiverForNonGlobal(isolate, JSObject::cast(*object)),
9341 isolate); 9346 isolate);
9342 9347
9343 // No need to unhole the value here. This is taken care of by the 9348 // No need to unhole the value here. This is taken care of by the
9344 // GetProperty function. 9349 // GetProperty function.
9345 MaybeObject* value = object->GetProperty(*name); 9350 Handle<Object> value = Object::GetProperty(object, name);
9346 return MakePair(value, *receiver_handle); 9351 RETURN_IF_EMPTY_HANDLE_VALUE(
9352 isolate, value, MakePair(Failure::Exception(), NULL));
9353 return MakePair(*value, *receiver_handle);
9347 } 9354 }
9348 9355
9349 if (throw_error) { 9356 if (throw_error) {
9350 // The property doesn't exist - throw exception. 9357 // The property doesn't exist - throw exception.
9351 Handle<Object> reference_error = 9358 Handle<Object> reference_error =
9352 isolate->factory()->NewReferenceError("not_defined", 9359 isolate->factory()->NewReferenceError("not_defined",
9353 HandleVector(&name, 1)); 9360 HandleVector(&name, 1));
9354 return MakePair(isolate->Throw(*reference_error), NULL); 9361 return MakePair(isolate->Throw(*reference_error), NULL);
9355 } else { 9362 } else {
9356 // The property doesn't exist - return undefined. 9363 // The property doesn't exist - return undefined.
(...skipping 5865 matching lines...) Expand 10 before | Expand all | Expand 10 after
15222 } 15229 }
15223 } 15230 }
15224 15231
15225 15232
15226 void Runtime::OutOfMemory() { 15233 void Runtime::OutOfMemory() {
15227 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15234 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15228 UNREACHABLE(); 15235 UNREACHABLE();
15229 } 15236 }
15230 15237
15231 } } // namespace v8::internal 15238 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698