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

Side by Side Diff: src/bootstrapper.cc

Issue 210953005: Clean up some "GetProperty" methods/functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments 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/api.cc ('k') | src/execution.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 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 // and the String function has been set up. 1931 // and the String function has been set up.
1932 Handle<JSFunction> string_function(native_context()->string_function()); 1932 Handle<JSFunction> string_function(native_context()->string_function());
1933 ASSERT(JSObject::cast( 1933 ASSERT(JSObject::cast(
1934 string_function->initial_map()->prototype())->HasFastProperties()); 1934 string_function->initial_map()->prototype())->HasFastProperties());
1935 native_context()->set_string_function_prototype_map( 1935 native_context()->set_string_function_prototype_map(
1936 HeapObject::cast(string_function->initial_map()->prototype())->map()); 1936 HeapObject::cast(string_function->initial_map()->prototype())->map());
1937 1937
1938 // Install Function.prototype.call and apply. 1938 // Install Function.prototype.call and apply.
1939 { Handle<String> key = factory()->function_class_string(); 1939 { Handle<String> key = factory()->function_class_string();
1940 Handle<JSFunction> function = 1940 Handle<JSFunction> function =
1941 Handle<JSFunction>::cast( 1941 Handle<JSFunction>::cast(Object::GetProperty(
1942 GetProperty(isolate(), isolate()->global_object(), key)); 1942 isolate()->global_object(), key));
1943 Handle<JSObject> proto = 1943 Handle<JSObject> proto =
1944 Handle<JSObject>(JSObject::cast(function->instance_prototype())); 1944 Handle<JSObject>(JSObject::cast(function->instance_prototype()));
1945 1945
1946 // Install the call and the apply functions. 1946 // Install the call and the apply functions.
1947 Handle<JSFunction> call = 1947 Handle<JSFunction> call =
1948 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, 1948 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize,
1949 Handle<JSObject>::null(), 1949 Handle<JSObject>::null(),
1950 Builtins::kFunctionCall, 1950 Builtins::kFunctionCall,
1951 false, false); 1951 false, false);
1952 Handle<JSFunction> apply = 1952 Handle<JSFunction> apply =
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 2069
2070 2070
2071 static Handle<JSObject> ResolveBuiltinIdHolder( 2071 static Handle<JSObject> ResolveBuiltinIdHolder(
2072 Handle<Context> native_context, 2072 Handle<Context> native_context,
2073 const char* holder_expr) { 2073 const char* holder_expr) {
2074 Isolate* isolate = native_context->GetIsolate(); 2074 Isolate* isolate = native_context->GetIsolate();
2075 Factory* factory = isolate->factory(); 2075 Factory* factory = isolate->factory();
2076 Handle<GlobalObject> global(native_context->global_object()); 2076 Handle<GlobalObject> global(native_context->global_object());
2077 const char* period_pos = strchr(holder_expr, '.'); 2077 const char* period_pos = strchr(holder_expr, '.');
2078 if (period_pos == NULL) { 2078 if (period_pos == NULL) {
2079 return Handle<JSObject>::cast(GetProperty( 2079 return Handle<JSObject>::cast(Object::GetPropertyOrElement(
2080 isolate, global, factory->InternalizeUtf8String(holder_expr))); 2080 global, factory->InternalizeUtf8String(holder_expr)));
2081 } 2081 }
2082 ASSERT_EQ(".prototype", period_pos); 2082 ASSERT_EQ(".prototype", period_pos);
2083 Vector<const char> property(holder_expr, 2083 Vector<const char> property(holder_expr,
2084 static_cast<int>(period_pos - holder_expr)); 2084 static_cast<int>(period_pos - holder_expr));
2085 Handle<String> property_string = factory->InternalizeUtf8String(property); 2085 Handle<String> property_string = factory->InternalizeUtf8String(property);
2086 ASSERT(!property_string.is_null()); 2086 ASSERT(!property_string.is_null());
2087 Handle<JSFunction> function = Handle<JSFunction>::cast( 2087 Handle<JSFunction> function = Handle<JSFunction>::cast(
2088 GetProperty(isolate, global, property_string)); 2088 Object::GetProperty(global, property_string));
2089 return Handle<JSObject>(JSObject::cast(function->prototype())); 2089 return Handle<JSObject>(JSObject::cast(function->prototype()));
2090 } 2090 }
2091 2091
2092 2092
2093 static void InstallBuiltinFunctionId(Handle<JSObject> holder, 2093 static void InstallBuiltinFunctionId(Handle<JSObject> holder,
2094 const char* function_name, 2094 const char* function_name,
2095 BuiltinFunctionId id) { 2095 BuiltinFunctionId id) {
2096 Factory* factory = holder->GetIsolate()->factory(); 2096 Factory* factory = holder->GetIsolate()->factory();
2097 Handle<String> name = factory->InternalizeUtf8String(function_name); 2097 Handle<String> name = factory->InternalizeUtf8String(function_name);
2098 Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked(); 2098 Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked();
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 return from + sizeof(NestingCounterType); 2753 return from + sizeof(NestingCounterType);
2754 } 2754 }
2755 2755
2756 2756
2757 // Called when the top-level V8 mutex is destroyed. 2757 // Called when the top-level V8 mutex is destroyed.
2758 void Bootstrapper::FreeThreadResources() { 2758 void Bootstrapper::FreeThreadResources() {
2759 ASSERT(!IsActive()); 2759 ASSERT(!IsActive());
2760 } 2760 }
2761 2761
2762 } } // namespace v8::internal 2762 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698