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

Side by Side Diff: src/runtime.cc

Issue 235943007: Handlify Object::ToObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase 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') | no next file » | 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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 symbol = isolate->factory()->NewPrivateSymbol(); 648 symbol = isolate->factory()->NewPrivateSymbol();
649 Handle<Symbol>::cast(symbol)->set_name(*name); 649 Handle<Symbol>::cast(symbol)->set_name(*name);
650 JSObject::SetProperty(Handle<JSObject>::cast(privates), 650 JSObject::SetProperty(Handle<JSObject>::cast(privates),
651 name, symbol, NONE, STRICT).Assert(); 651 name, symbol, NONE, STRICT).Assert();
652 } 652 }
653 return *symbol; 653 return *symbol;
654 } 654 }
655 655
656 656
657 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewSymbolWrapper) { 657 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewSymbolWrapper) {
658 HandleScope scope(isolate);
658 ASSERT(args.length() == 1); 659 ASSERT(args.length() == 1);
659 CONVERT_ARG_CHECKED(Symbol, symbol, 0); 660 CONVERT_ARG_HANDLE_CHECKED(Symbol, symbol, 0);
660 return symbol->ToObject(isolate); 661 return *Object::ToObject(isolate, symbol).ToHandleChecked();
661 } 662 }
662 663
663 664
664 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolDescription) { 665 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolDescription) {
665 SealHandleScope shs(isolate); 666 SealHandleScope shs(isolate);
666 ASSERT(args.length() == 1); 667 ASSERT(args.length() == 1);
667 CONVERT_ARG_CHECKED(Symbol, symbol, 0); 668 CONVERT_ARG_CHECKED(Symbol, symbol, 0);
668 return symbol->name(); 669 return symbol->name();
669 } 670 }
670 671
(...skipping 6171 matching lines...) Expand 10 before | Expand all | Expand 10 after
6842 for (int i = 0; i < length; ++i) { 6843 for (int i = 0; i < length; ++i) {
6843 ASSERT(String::cast(elements->get(i))->length() == 1); 6844 ASSERT(String::cast(elements->get(i))->length() == 1);
6844 } 6845 }
6845 #endif 6846 #endif
6846 6847
6847 return *isolate->factory()->NewJSArrayWithElements(elements); 6848 return *isolate->factory()->NewJSArrayWithElements(elements);
6848 } 6849 }
6849 6850
6850 6851
6851 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewStringWrapper) { 6852 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewStringWrapper) {
6852 SealHandleScope shs(isolate); 6853 HandleScope scope(isolate);
6853 ASSERT(args.length() == 1); 6854 ASSERT(args.length() == 1);
6854 CONVERT_ARG_CHECKED(String, value, 0); 6855 CONVERT_ARG_HANDLE_CHECKED(String, value, 0);
6855 return value->ToObject(isolate); 6856 return *Object::ToObject(isolate, value).ToHandleChecked();
6856 } 6857 }
6857 6858
6858 6859
6859 bool Runtime::IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch) { 6860 bool Runtime::IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch) {
6860 unibrow::uchar chars[unibrow::ToUppercase::kMaxWidth]; 6861 unibrow::uchar chars[unibrow::ToUppercase::kMaxWidth];
6861 int char_length = runtime_state->to_upper_mapping()->get(ch, 0, chars); 6862 int char_length = runtime_state->to_upper_mapping()->get(ch, 0, chars);
6862 return char_length == 0; 6863 return char_length == 0;
6863 } 6864 }
6864 6865
6865 6866
(...skipping 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after
8945 } 8946 }
8946 8947
8947 8948
8948 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_PushWithContext) { 8949 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_PushWithContext) {
8949 HandleScope scope(isolate); 8950 HandleScope scope(isolate);
8950 ASSERT(args.length() == 2); 8951 ASSERT(args.length() == 2);
8951 Handle<JSReceiver> extension_object; 8952 Handle<JSReceiver> extension_object;
8952 if (args[0]->IsJSReceiver()) { 8953 if (args[0]->IsJSReceiver()) {
8953 extension_object = args.at<JSReceiver>(0); 8954 extension_object = args.at<JSReceiver>(0);
8954 } else { 8955 } else {
8955 // Convert the object to a proper JavaScript object. 8956 // Try to convert the object to a proper JavaScript object.
8956 Handle<Object> object = isolate->factory()->ToObject(args.at<Object>(0)); 8957 MaybeHandle<JSReceiver> maybe_object =
8957 if (object.is_null()) { 8958 Object::ToObject(isolate, args.at<Object>(0));
8959 if (!maybe_object.ToHandle(&extension_object)) {
8958 Handle<Object> handle = args.at<Object>(0); 8960 Handle<Object> handle = args.at<Object>(0);
8959 Handle<Object> result = 8961 Handle<Object> result =
8960 isolate->factory()->NewTypeError("with_expression", 8962 isolate->factory()->NewTypeError("with_expression",
8961 HandleVector(&handle, 1)); 8963 HandleVector(&handle, 1));
8962 return isolate->Throw(*result); 8964 return isolate->Throw(*result);
8963 } 8965 }
8964 extension_object = Handle<JSReceiver>::cast(object);
8965 } 8966 }
8966 8967
8967 Handle<JSFunction> function; 8968 Handle<JSFunction> function;
8968 if (args[1]->IsSmi()) { 8969 if (args[1]->IsSmi()) {
8969 // A smi sentinel indicates a context nested inside global code rather 8970 // A smi sentinel indicates a context nested inside global code rather
8970 // than some function. There is a canonical empty function that can be 8971 // than some function. There is a canonical empty function that can be
8971 // gotten from the native context. 8972 // gotten from the native context.
8972 function = handle(isolate->context()->native_context()->closure()); 8973 function = handle(isolate->context()->native_context()->closure());
8973 } else { 8974 } else {
8974 function = args.at<JSFunction>(1); 8975 function = args.at<JSFunction>(1);
(...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after
11359 // by creating correct wrapper object based on the calling frame's 11360 // by creating correct wrapper object based on the calling frame's
11360 // native context. 11361 // native context.
11361 it.Advance(); 11362 it.Advance();
11362 if (receiver->IsUndefined()) { 11363 if (receiver->IsUndefined()) {
11363 Context* context = function->context(); 11364 Context* context = function->context();
11364 receiver = handle(context->global_object()->global_receiver()); 11365 receiver = handle(context->global_object()->global_receiver());
11365 } else { 11366 } else {
11366 ASSERT(!receiver->IsNull()); 11367 ASSERT(!receiver->IsNull());
11367 Context* context = Context::cast(it.frame()->context()); 11368 Context* context = Context::cast(it.frame()->context());
11368 Handle<Context> native_context(Context::cast(context->native_context())); 11369 Handle<Context> native_context(Context::cast(context->native_context()));
11369 receiver = isolate->factory()->ToObject(receiver, native_context); 11370 receiver = Object::ToObject(
11371 isolate, receiver, native_context).ToHandleChecked();
11370 } 11372 }
11371 } 11373 }
11372 details->set(kFrameDetailsReceiverIndex, *receiver); 11374 details->set(kFrameDetailsReceiverIndex, *receiver);
11373 11375
11374 ASSERT_EQ(details_size, details_index); 11376 ASSERT_EQ(details_size, details_index);
11375 return *isolate->factory()->NewJSArrayWithElements(details); 11377 return *isolate->factory()->NewJSArrayWithElements(details);
11376 } 11378 }
11377 11379
11378 11380
11379 static bool ParameterIsShadowedByContextLocal(Handle<ScopeInfo> info, 11381 static bool ParameterIsShadowedByContextLocal(Handle<ScopeInfo> info,
(...skipping 3772 matching lines...) Expand 10 before | Expand all | Expand 10 after
15152 } 15154 }
15153 } 15155 }
15154 15156
15155 15157
15156 void Runtime::OutOfMemory() { 15158 void Runtime::OutOfMemory() {
15157 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15159 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15158 UNREACHABLE(); 15160 UNREACHABLE();
15159 } 15161 }
15160 15162
15161 } } // namespace v8::internal 15163 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698