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

Side by Side Diff: src/builtins.cc

Issue 6696042: Adding 'isolates' argument to LOG to get rid of multiple TLS fetches in profiling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/isolates
Patch Set: Created 9 years, 9 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 JSObject::cast(global_context->array_function()->prototype()); 404 JSObject::cast(global_context->array_function()->prototype());
405 return receiver->GetPrototype() == array_proto && 405 return receiver->GetPrototype() == array_proto &&
406 ArrayPrototypeHasNoElements(heap, global_context, array_proto); 406 ArrayPrototypeHasNoElements(heap, global_context, array_proto);
407 } 407 }
408 408
409 409
410 MUST_USE_RESULT static MaybeObject* CallJsBuiltin( 410 MUST_USE_RESULT static MaybeObject* CallJsBuiltin(
411 Isolate* isolate, 411 Isolate* isolate,
412 const char* name, 412 const char* name,
413 BuiltinArguments<NO_EXTRA_ARGUMENTS> args) { 413 BuiltinArguments<NO_EXTRA_ARGUMENTS> args) {
414 HandleScope handleScope; 414 HandleScope handleScope(isolate);
415 415
416 Handle<Object> js_builtin = 416 Handle<Object> js_builtin =
417 GetProperty(Handle<JSObject>( 417 GetProperty(Handle<JSObject>(
418 isolate->global_context()->builtins()), 418 isolate->global_context()->builtins()),
419 name); 419 name);
420 ASSERT(js_builtin->IsJSFunction()); 420 ASSERT(js_builtin->IsJSFunction());
421 Handle<JSFunction> function(Handle<JSFunction>::cast(js_builtin)); 421 Handle<JSFunction> function(Handle<JSFunction>::cast(js_builtin));
422 ScopedVector<Object**> argv(args.length() - 1); 422 ScopedVector<Object**> argv(args.length() - 1);
423 int n_args = args.length() - 1; 423 int n_args = args.length() - 1;
424 for (int i = 0; i < n_args; i++) { 424 for (int i = 0; i < n_args; i++) {
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 return holder; 1031 return holder;
1032 } 1032 }
1033 1033
1034 1034
1035 template <bool is_construct> 1035 template <bool is_construct>
1036 MUST_USE_RESULT static MaybeObject* HandleApiCallHelper( 1036 MUST_USE_RESULT static MaybeObject* HandleApiCallHelper(
1037 BuiltinArguments<NEEDS_CALLED_FUNCTION> args, Isolate* isolate) { 1037 BuiltinArguments<NEEDS_CALLED_FUNCTION> args, Isolate* isolate) {
1038 ASSERT(is_construct == CalledAsConstructor(isolate)); 1038 ASSERT(is_construct == CalledAsConstructor(isolate));
1039 Heap* heap = isolate->heap(); 1039 Heap* heap = isolate->heap();
1040 1040
1041 HandleScope scope; 1041 HandleScope scope(isolate);
1042 Handle<JSFunction> function = args.called_function(); 1042 Handle<JSFunction> function = args.called_function();
1043 ASSERT(function->shared()->IsApiFunction()); 1043 ASSERT(function->shared()->IsApiFunction());
1044 1044
1045 FunctionTemplateInfo* fun_data = function->shared()->get_api_func_data(); 1045 FunctionTemplateInfo* fun_data = function->shared()->get_api_func_data();
1046 if (is_construct) { 1046 if (is_construct) {
1047 Handle<FunctionTemplateInfo> desc(fun_data); 1047 Handle<FunctionTemplateInfo> desc(fun_data);
1048 bool pending_exception = false; 1048 bool pending_exception = false;
1049 isolate->factory()->ConfigureInstance( 1049 isolate->factory()->ConfigureInstance(
1050 desc, Handle<JSObject>::cast(args.receiver()), &pending_exception); 1050 desc, Handle<JSObject>::cast(args.receiver()), &pending_exception);
1051 ASSERT(isolate->has_pending_exception() == pending_exception); 1051 ASSERT(isolate->has_pending_exception() == pending_exception);
(...skipping 13 matching lines...) Expand all
1065 1065
1066 Object* raw_call_data = fun_data->call_code(); 1066 Object* raw_call_data = fun_data->call_code();
1067 if (!raw_call_data->IsUndefined()) { 1067 if (!raw_call_data->IsUndefined()) {
1068 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); 1068 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data);
1069 Object* callback_obj = call_data->callback(); 1069 Object* callback_obj = call_data->callback();
1070 v8::InvocationCallback callback = 1070 v8::InvocationCallback callback =
1071 v8::ToCData<v8::InvocationCallback>(callback_obj); 1071 v8::ToCData<v8::InvocationCallback>(callback_obj);
1072 Object* data_obj = call_data->data(); 1072 Object* data_obj = call_data->data();
1073 Object* result; 1073 Object* result;
1074 1074
1075 LOG(ApiObjectAccess("call", JSObject::cast(*args.receiver()))); 1075 LOG(isolate, ApiObjectAccess("call", JSObject::cast(*args.receiver())));
1076 ASSERT(raw_holder->IsJSObject()); 1076 ASSERT(raw_holder->IsJSObject());
1077 1077
1078 CustomArguments custom(isolate); 1078 CustomArguments custom(isolate);
1079 v8::ImplementationUtilities::PrepareArgumentsData(custom.end(), 1079 v8::ImplementationUtilities::PrepareArgumentsData(custom.end(),
1080 data_obj, *function, raw_holder); 1080 data_obj, *function, raw_holder);
1081 1081
1082 v8::Arguments new_args = v8::ImplementationUtilities::NewArguments( 1082 v8::Arguments new_args = v8::ImplementationUtilities::NewArguments(
1083 custom.end(), 1083 custom.end(),
1084 &args[0] - 1, 1084 &args[0] - 1,
1085 args.length() - 1, 1085 args.length() - 1,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 constructor->shared()->get_api_func_data()->instance_call_handler(); 1205 constructor->shared()->get_api_func_data()->instance_call_handler();
1206 ASSERT(!handler->IsUndefined()); 1206 ASSERT(!handler->IsUndefined());
1207 CallHandlerInfo* call_data = CallHandlerInfo::cast(handler); 1207 CallHandlerInfo* call_data = CallHandlerInfo::cast(handler);
1208 Object* callback_obj = call_data->callback(); 1208 Object* callback_obj = call_data->callback();
1209 v8::InvocationCallback callback = 1209 v8::InvocationCallback callback =
1210 v8::ToCData<v8::InvocationCallback>(callback_obj); 1210 v8::ToCData<v8::InvocationCallback>(callback_obj);
1211 1211
1212 // Get the data for the call and perform the callback. 1212 // Get the data for the call and perform the callback.
1213 Object* result; 1213 Object* result;
1214 { 1214 {
1215 HandleScope scope; 1215 HandleScope scope(isolate);
1216 1216
1217 LOG(ApiObjectAccess("call non-function", obj)); 1217 LOG(isolate, ApiObjectAccess("call non-function", obj));
1218 1218
1219 CustomArguments custom(isolate); 1219 CustomArguments custom(isolate);
1220 v8::ImplementationUtilities::PrepareArgumentsData(custom.end(), 1220 v8::ImplementationUtilities::PrepareArgumentsData(custom.end(),
1221 call_data->data(), constructor, obj); 1221 call_data->data(), constructor, obj);
1222 v8::Arguments new_args = v8::ImplementationUtilities::NewArguments( 1222 v8::Arguments new_args = v8::ImplementationUtilities::NewArguments(
1223 custom.end(), 1223 custom.end(),
1224 &args[0] - 1, 1224 &args[0] - 1,
1225 args.length() - 1, 1225 args.length() - 1,
1226 is_construct_call); 1226 is_construct_call);
1227 v8::Handle<v8::Value> value; 1227 v8::Handle<v8::Value> value;
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 // This simplifies things because we don't need to retry. 1596 // This simplifies things because we don't need to retry.
1597 AlwaysAllocateScope __scope__; 1597 AlwaysAllocateScope __scope__;
1598 { MaybeObject* maybe_code = 1598 { MaybeObject* maybe_code =
1599 heap->CreateCode(desc, flags, masm.CodeObject()); 1599 heap->CreateCode(desc, flags, masm.CodeObject());
1600 if (!maybe_code->ToObject(&code)) { 1600 if (!maybe_code->ToObject(&code)) {
1601 v8::internal::V8::FatalProcessOutOfMemory("CreateCode"); 1601 v8::internal::V8::FatalProcessOutOfMemory("CreateCode");
1602 } 1602 }
1603 } 1603 }
1604 } 1604 }
1605 // Log the event and add the code to the builtins array. 1605 // Log the event and add the code to the builtins array.
1606 PROFILE(CodeCreateEvent(Logger::BUILTIN_TAG, 1606 PROFILE(ISOLATE,
1607 CodeCreateEvent(Logger::BUILTIN_TAG,
1607 Code::cast(code), 1608 Code::cast(code),
1608 functions[i].s_name)); 1609 functions[i].s_name));
1609 GDBJIT(AddCode(GDBJITInterface::BUILTIN, 1610 GDBJIT(AddCode(GDBJITInterface::BUILTIN,
1610 functions[i].s_name, 1611 functions[i].s_name,
1611 Code::cast(code))); 1612 Code::cast(code)));
1612 builtins_[i] = code; 1613 builtins_[i] = code;
1613 #ifdef ENABLE_DISASSEMBLER 1614 #ifdef ENABLE_DISASSEMBLER
1614 if (FLAG_print_builtin_code) { 1615 if (FLAG_print_builtin_code) {
1615 PrintF("Builtin: %s\n", functions[i].s_name); 1616 PrintF("Builtin: %s\n", functions[i].s_name);
1616 Code::cast(code)->Disassemble(functions[i].s_name); 1617 Code::cast(code)->Disassemble(functions[i].s_name);
(...skipping 30 matching lines...) Expand all
1647 if (entry->contains(pc)) { 1648 if (entry->contains(pc)) {
1648 return names_[i]; 1649 return names_[i];
1649 } 1650 }
1650 } 1651 }
1651 } 1652 }
1652 return NULL; 1653 return NULL;
1653 } 1654 }
1654 1655
1655 1656
1656 } } // namespace v8::internal 1657 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698