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

Side by Side Diff: src/runtime.cc

Issue 10879013: Make order of addition the primary order of descriptor arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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-details.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 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 NoHandleAllocation ha; 2159 NoHandleAllocation ha;
2160 RUNTIME_ASSERT(args.length() == 1); 2160 RUNTIME_ASSERT(args.length() == 1);
2161 CONVERT_ARG_CHECKED(JSFunction, function, 0); 2161 CONVERT_ARG_CHECKED(JSFunction, function, 0);
2162 2162
2163 String* name = isolate->heap()->prototype_symbol(); 2163 String* name = isolate->heap()->prototype_symbol();
2164 2164
2165 if (function->HasFastProperties()) { 2165 if (function->HasFastProperties()) {
2166 // Construct a new field descriptor with updated attributes. 2166 // Construct a new field descriptor with updated attributes.
2167 DescriptorArray* instance_desc = function->map()->instance_descriptors(); 2167 DescriptorArray* instance_desc = function->map()->instance_descriptors();
2168 2168
2169 int index = instance_desc->Search(name); 2169 int index = instance_desc->SearchWithCache(name);
2170 ASSERT(index != DescriptorArray::kNotFound); 2170 ASSERT(index != DescriptorArray::kNotFound);
2171 PropertyDetails details = instance_desc->GetDetails(index); 2171 PropertyDetails details = instance_desc->GetDetails(index);
2172 2172
2173 CallbacksDescriptor new_desc(name, 2173 CallbacksDescriptor new_desc(name,
2174 instance_desc->GetValue(index), 2174 instance_desc->GetValue(index),
2175 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), 2175 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY),
2176 details.index()); 2176 details.descriptor_index());
2177 2177
2178 // Create a new map featuring the new field descriptors array. 2178 // Create a new map featuring the new field descriptors array.
2179 Map* new_map; 2179 Map* new_map;
2180 MaybeObject* maybe_map = 2180 MaybeObject* maybe_map =
2181 function->map()->CopyReplaceDescriptor( 2181 function->map()->CopyReplaceDescriptor(
2182 &new_desc, index, OMIT_TRANSITION); 2182 &new_desc, index, OMIT_TRANSITION);
2183 if (!maybe_map->To(&new_map)) return maybe_map; 2183 if (!maybe_map->To(&new_map)) return maybe_map;
2184 2184
2185 function->set_map(new_map); 2185 function->set_map(new_map);
2186 } else { // Dictionary properties. 2186 } else { // Dictionary properties.
2187 // Directly manipulate the property details. 2187 // Directly manipulate the property details.
2188 int entry = function->property_dictionary()->FindEntry(name); 2188 int entry = function->property_dictionary()->FindEntry(name);
2189 ASSERT(entry != StringDictionary::kNotFound); 2189 ASSERT(entry != StringDictionary::kNotFound);
2190 PropertyDetails details = function->property_dictionary()->DetailsAt(entry); 2190 PropertyDetails details = function->property_dictionary()->DetailsAt(entry);
2191 PropertyDetails new_details( 2191 PropertyDetails new_details(
2192 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), 2192 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY),
2193 details.type(), 2193 details.type(),
2194 details.index()); 2194 details.dictionary_index());
2195 function->property_dictionary()->DetailsAtPut(entry, new_details); 2195 function->property_dictionary()->DetailsAtPut(entry, new_details);
2196 } 2196 }
2197 return function; 2197 return function;
2198 } 2198 }
2199 2199
2200 2200
2201 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsAPIFunction) { 2201 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsAPIFunction) {
2202 NoHandleAllocation ha; 2202 NoHandleAllocation ha;
2203 ASSERT(args.length() == 1); 2203 ASSERT(args.length() == 1);
2204 2204
(...skipping 8302 matching lines...) Expand 10 before | Expand all | Expand 10 after
10507 CONVERT_PROPERTY_DETAILS_CHECKED(details, 0); 10507 CONVERT_PROPERTY_DETAILS_CHECKED(details, 0);
10508 return Smi::FromInt(static_cast<int>(details.attributes())); 10508 return Smi::FromInt(static_cast<int>(details.attributes()));
10509 } 10509 }
10510 10510
10511 10511
10512 // Return the property insertion index calculated from the property details. 10512 // Return the property insertion index calculated from the property details.
10513 // args[0]: smi with property details. 10513 // args[0]: smi with property details.
10514 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyIndexFromDetails) { 10514 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPropertyIndexFromDetails) {
10515 ASSERT(args.length() == 1); 10515 ASSERT(args.length() == 1);
10516 CONVERT_PROPERTY_DETAILS_CHECKED(details, 0); 10516 CONVERT_PROPERTY_DETAILS_CHECKED(details, 0);
10517 return Smi::FromInt(details.index()); 10517 // TODO(verwaest): Depends on the type of details.
10518 return Smi::FromInt(details.dictionary_index());
10518 } 10519 }
10519 10520
10520 10521
10521 // Return property value from named interceptor. 10522 // Return property value from named interceptor.
10522 // args[0]: object 10523 // args[0]: object
10523 // args[1]: property name 10524 // args[1]: property name
10524 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugNamedInterceptorPropertyValue) { 10525 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugNamedInterceptorPropertyValue) {
10525 HandleScope scope(isolate); 10526 HandleScope scope(isolate);
10526 ASSERT(args.length() == 2); 10527 ASSERT(args.length() == 2);
10527 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); 10528 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
(...skipping 3190 matching lines...) Expand 10 before | Expand all | Expand 10 after
13718 // Handle last resort GC and make sure to allow future allocations 13719 // Handle last resort GC and make sure to allow future allocations
13719 // to grow the heap without causing GCs (if possible). 13720 // to grow the heap without causing GCs (if possible).
13720 isolate->counters()->gc_last_resort_from_js()->Increment(); 13721 isolate->counters()->gc_last_resort_from_js()->Increment();
13721 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13722 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13722 "Runtime::PerformGC"); 13723 "Runtime::PerformGC");
13723 } 13724 }
13724 } 13725 }
13725 13726
13726 13727
13727 } } // namespace v8::internal 13728 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/property-details.h ('k') | src/transitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698