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

Side by Side Diff: src/runtime.cc

Issue 228333003: Handlefy Descriptor and other code in objects.cc (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Formatting stuff. 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/property.h ('k') | src/transitions.h » ('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 2926 matching lines...) Expand 10 before | Expand all | Expand 10 after
2937 Accessors::FunctionSetPrototype(fun, value); 2937 Accessors::FunctionSetPrototype(fun, value);
2938 return args[0]; // return TOS 2938 return args[0]; // return TOS
2939 } 2939 }
2940 2940
2941 2941
2942 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) { 2942 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) {
2943 HandleScope shs(isolate); 2943 HandleScope shs(isolate);
2944 RUNTIME_ASSERT(args.length() == 1); 2944 RUNTIME_ASSERT(args.length() == 1);
2945 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 2945 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
2946 2946
2947 String* name = isolate->heap()->prototype_string(); 2947 Handle<String> name = isolate->factory()->prototype_string();
2948 2948
2949 if (function->HasFastProperties()) { 2949 if (function->HasFastProperties()) {
2950 // Construct a new field descriptor with updated attributes. 2950 // Construct a new field descriptor with updated attributes.
2951 DescriptorArray* instance_desc = function->map()->instance_descriptors(); 2951 Handle<DescriptorArray> instance_desc =
2952 handle(function->map()->instance_descriptors());
2952 2953
2953 int index = instance_desc->SearchWithCache(name, function->map()); 2954 int index = instance_desc->SearchWithCache(*name, function->map());
2954 ASSERT(index != DescriptorArray::kNotFound); 2955 ASSERT(index != DescriptorArray::kNotFound);
2955 PropertyDetails details = instance_desc->GetDetails(index); 2956 PropertyDetails details = instance_desc->GetDetails(index);
2956 2957
2957 CallbacksDescriptor new_desc(name, 2958 CallbacksDescriptor new_desc(
2958 instance_desc->GetValue(index), 2959 name,
2960 handle(instance_desc->GetValue(index), isolate),
2959 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY)); 2961 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY));
2960 2962
2961 // Create a new map featuring the new field descriptors array. 2963 // Create a new map featuring the new field descriptors array.
2962 Map* new_map; 2964 Handle<Map> map = handle(function->map());
2963 MaybeObject* maybe_map = 2965 Handle<Map> new_map = Map::CopyReplaceDescriptor(
2964 function->map()->CopyReplaceDescriptor( 2966 map, instance_desc, &new_desc, index, OMIT_TRANSITION);
2965 instance_desc, &new_desc, index, OMIT_TRANSITION);
2966 if (!maybe_map->To(&new_map)) return maybe_map;
2967 2967
2968 JSObject::MigrateToMap(function, handle(new_map)); 2968 JSObject::MigrateToMap(function, new_map);
2969 } else { // Dictionary properties. 2969 } else { // Dictionary properties.
2970 // Directly manipulate the property details. 2970 // Directly manipulate the property details.
2971 DisallowHeapAllocation no_gc; 2971 DisallowHeapAllocation no_gc;
2972 int entry = function->property_dictionary()->FindEntry(name); 2972 int entry = function->property_dictionary()->FindEntry(*name);
2973 ASSERT(entry != NameDictionary::kNotFound); 2973 ASSERT(entry != NameDictionary::kNotFound);
2974 PropertyDetails details = function->property_dictionary()->DetailsAt(entry); 2974 PropertyDetails details = function->property_dictionary()->DetailsAt(entry);
2975 PropertyDetails new_details( 2975 PropertyDetails new_details(
2976 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), 2976 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY),
2977 details.type(), 2977 details.type(),
2978 details.dictionary_index()); 2978 details.dictionary_index());
2979 function->property_dictionary()->DetailsAtPut(entry, new_details); 2979 function->property_dictionary()->DetailsAtPut(entry, new_details);
2980 } 2980 }
2981 return *function; 2981 return *function;
2982 } 2982 }
(...skipping 12231 matching lines...) Expand 10 before | Expand all | Expand 10 after
15214 } 15214 }
15215 } 15215 }
15216 15216
15217 15217
15218 void Runtime::OutOfMemory() { 15218 void Runtime::OutOfMemory() {
15219 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15219 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15220 UNREACHABLE(); 15220 UNREACHABLE();
15221 } 15221 }
15222 15222
15223 } } // namespace v8::internal 15223 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/property.h ('k') | src/transitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698