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

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: Created 6 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
« no previous file with comments | « src/api.cc ('k') | src/execution.cc » ('j') | src/execution.cc » ('J')
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(
Igor Sheludko 2014/03/26 18:37:31 We don't need all the checks performed by Runtime:
Yang 2014/03/28 09:56:58 Right. The object is the global object (not a stri
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 2071
2072 2072
2073 static Handle<JSObject> ResolveBuiltinIdHolder( 2073 static Handle<JSObject> ResolveBuiltinIdHolder(
2074 Handle<Context> native_context, 2074 Handle<Context> native_context,
2075 const char* holder_expr) { 2075 const char* holder_expr) {
2076 Isolate* isolate = native_context->GetIsolate(); 2076 Isolate* isolate = native_context->GetIsolate();
2077 Factory* factory = isolate->factory(); 2077 Factory* factory = isolate->factory();
2078 Handle<GlobalObject> global(native_context->global_object()); 2078 Handle<GlobalObject> global(native_context->global_object());
2079 const char* period_pos = strchr(holder_expr, '.'); 2079 const char* period_pos = strchr(holder_expr, '.');
2080 if (period_pos == NULL) { 2080 if (period_pos == NULL) {
2081 return Handle<JSObject>::cast(GetProperty( 2081 return Handle<JSObject>::cast(Object::GetPropertyOrElement(
2082 isolate, global, factory->InternalizeUtf8String(holder_expr))); 2082 global, factory->InternalizeUtf8String(holder_expr)));
2083 } 2083 }
2084 ASSERT_EQ(".prototype", period_pos); 2084 ASSERT_EQ(".prototype", period_pos);
2085 Vector<const char> property(holder_expr, 2085 Vector<const char> property(holder_expr,
2086 static_cast<int>(period_pos - holder_expr)); 2086 static_cast<int>(period_pos - holder_expr));
2087 Handle<String> property_string = factory->InternalizeUtf8String(property); 2087 Handle<String> property_string = factory->InternalizeUtf8String(property);
2088 ASSERT(!property_string.is_null()); 2088 ASSERT(!property_string.is_null());
2089 Handle<JSFunction> function = Handle<JSFunction>::cast( 2089 Handle<JSFunction> function = Handle<JSFunction>::cast(
2090 GetProperty(isolate, global, property_string)); 2090 Object::GetProperty(global, property_string));
2091 return Handle<JSObject>(JSObject::cast(function->prototype())); 2091 return Handle<JSObject>(JSObject::cast(function->prototype()));
2092 } 2092 }
2093 2093
2094 2094
2095 static void InstallBuiltinFunctionId(Handle<JSObject> holder, 2095 static void InstallBuiltinFunctionId(Handle<JSObject> holder,
2096 const char* function_name, 2096 const char* function_name,
2097 BuiltinFunctionId id) { 2097 BuiltinFunctionId id) {
2098 Factory* factory = holder->GetIsolate()->factory(); 2098 Factory* factory = holder->GetIsolate()->factory();
2099 Handle<String> name = factory->InternalizeUtf8String(function_name); 2099 Handle<String> name = factory->InternalizeUtf8String(function_name);
2100 Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked(); 2100 Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked();
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 return from + sizeof(NestingCounterType); 2755 return from + sizeof(NestingCounterType);
2756 } 2756 }
2757 2757
2758 2758
2759 // Called when the top-level V8 mutex is destroyed. 2759 // Called when the top-level V8 mutex is destroyed.
2760 void Bootstrapper::FreeThreadResources() { 2760 void Bootstrapper::FreeThreadResources() {
2761 ASSERT(!IsActive()); 2761 ASSERT(!IsActive());
2762 } 2762 }
2763 2763
2764 } } // namespace v8::internal 2764 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/execution.cc » ('j') | src/execution.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698