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

Side by Side Diff: src/runtime.cc

Issue 14451003: Pretenure ASCII cons string in high promotion mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // slow properties mode for now. We don't go in the map cache because 227 // slow properties mode for now. We don't go in the map cache because
228 // maps with constant functions can't be shared if the functions are 228 // maps with constant functions can't be shared if the functions are
229 // not the same (which is the common case). 229 // not the same (which is the common case).
230 bool is_result_from_cache = false; 230 bool is_result_from_cache = false;
231 Handle<Map> map = has_function_literal 231 Handle<Map> map = has_function_literal
232 ? Handle<Map>(context->object_function()->initial_map()) 232 ? Handle<Map>(context->object_function()->initial_map())
233 : ComputeObjectLiteralMap(context, 233 : ComputeObjectLiteralMap(context,
234 constant_properties, 234 constant_properties,
235 &is_result_from_cache); 235 &is_result_from_cache);
236 236
237 Handle<JSObject> boilerplate = isolate->factory()->NewJSObjectFromMap(map); 237 Handle<JSObject> boilerplate;
238 if (isolate->heap()->ShouldGloballyPretenure()) {
239 boilerplate = isolate->factory()->NewJSObjectFromMap(map, TENURED);
Michael Starzinger 2013/05/03 09:33:10 Can we add a "Heap::GetGlobalPretenureFlag()" help
Hannes Payer (out of office) 2013/05/03 09:35:43 Done.
240 } else {
241 boilerplate = isolate->factory()->NewJSObjectFromMap(map);
242 }
238 243
239 // Normalize the elements of the boilerplate to save space if needed. 244 // Normalize the elements of the boilerplate to save space if needed.
240 if (!should_have_fast_elements) JSObject::NormalizeElements(boilerplate); 245 if (!should_have_fast_elements) JSObject::NormalizeElements(boilerplate);
241 246
242 // Add the constant properties to the boilerplate. 247 // Add the constant properties to the boilerplate.
243 int length = constant_properties->length(); 248 int length = constant_properties->length();
244 bool should_transform = 249 bool should_transform =
245 !is_result_from_cache && boilerplate->HasFastProperties(); 250 !is_result_from_cache && boilerplate->HasFastProperties();
246 if (should_transform || has_function_literal) { 251 if (should_transform || has_function_literal) {
247 // Normalize the properties of object to avoid n^2 behavior 252 // Normalize the properties of object to avoid n^2 behavior
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 static const int kSmiLiteralMinimumLength = 1024; 336 static const int kSmiLiteralMinimumLength = 1024;
332 337
333 338
334 Handle<Object> Runtime::CreateArrayLiteralBoilerplate( 339 Handle<Object> Runtime::CreateArrayLiteralBoilerplate(
335 Isolate* isolate, 340 Isolate* isolate,
336 Handle<FixedArray> literals, 341 Handle<FixedArray> literals,
337 Handle<FixedArray> elements) { 342 Handle<FixedArray> elements) {
338 // Create the JSArray. 343 // Create the JSArray.
339 Handle<JSFunction> constructor( 344 Handle<JSFunction> constructor(
340 JSFunction::NativeContextFromLiterals(*literals)->array_function()); 345 JSFunction::NativeContextFromLiterals(*literals)->array_function());
341 Handle<JSArray> object = 346
342 Handle<JSArray>::cast(isolate->factory()->NewJSObject(constructor)); 347 Handle<JSArray> object;
348 if (isolate->heap()->ShouldGloballyPretenure()) {
349 object = Handle<JSArray>::cast(
350 isolate->factory()->NewJSObject(constructor, TENURED));
351 } else {
352 object = Handle<JSArray>::cast(
353 isolate->factory()->NewJSObject(constructor));
354 }
343 355
344 ElementsKind constant_elements_kind = 356 ElementsKind constant_elements_kind =
345 static_cast<ElementsKind>(Smi::cast(elements->get(0))->value()); 357 static_cast<ElementsKind>(Smi::cast(elements->get(0))->value());
346 Handle<FixedArrayBase> constant_elements_values( 358 Handle<FixedArrayBase> constant_elements_values(
347 FixedArrayBase::cast(elements->get(1))); 359 FixedArrayBase::cast(elements->get(1)));
348 360
349 ASSERT(IsFastElementsKind(constant_elements_kind)); 361 ASSERT(IsFastElementsKind(constant_elements_kind));
350 Context* native_context = isolate->context()->native_context(); 362 Context* native_context = isolate->context()->native_context();
351 Object* maybe_maps_array = native_context->js_array_maps(); 363 Object* maybe_maps_array = native_context->js_array_maps();
352 ASSERT(!maybe_maps_array->IsUndefined()); 364 ASSERT(!maybe_maps_array->IsUndefined());
(...skipping 5771 matching lines...) Expand 10 before | Expand all | Expand 10 after
6124 } 6136 }
6125 6137
6126 6138
6127 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToStringSkipCache) { 6139 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToStringSkipCache) {
6128 NoHandleAllocation ha(isolate); 6140 NoHandleAllocation ha(isolate);
6129 ASSERT(args.length() == 1); 6141 ASSERT(args.length() == 1);
6130 6142
6131 Object* number = args[0]; 6143 Object* number = args[0];
6132 RUNTIME_ASSERT(number->IsNumber()); 6144 RUNTIME_ASSERT(number->IsNumber());
6133 6145
6146 if (isolate->heap()->ShouldGloballyPretenure()) {
6147 return isolate->heap()->NumberToString(number, false, TENURED);
6148 }
6134 return isolate->heap()->NumberToString(number, false); 6149 return isolate->heap()->NumberToString(number, false);
6135 } 6150 }
6136 6151
6137 6152
6138 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToInteger) { 6153 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToInteger) {
6139 NoHandleAllocation ha(isolate); 6154 NoHandleAllocation ha(isolate);
6140 ASSERT(args.length() == 1); 6155 ASSERT(args.length() == 1);
6141 6156
6142 CONVERT_DOUBLE_ARG_CHECKED(number, 0); 6157 CONVERT_DOUBLE_ARG_CHECKED(number, 0);
6143 6158
(...skipping 7233 matching lines...) Expand 10 before | Expand all | Expand 10 after
13377 // Handle last resort GC and make sure to allow future allocations 13392 // Handle last resort GC and make sure to allow future allocations
13378 // to grow the heap without causing GCs (if possible). 13393 // to grow the heap without causing GCs (if possible).
13379 isolate->counters()->gc_last_resort_from_js()->Increment(); 13394 isolate->counters()->gc_last_resort_from_js()->Increment();
13380 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13395 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13381 "Runtime::PerformGC"); 13396 "Runtime::PerformGC");
13382 } 13397 }
13383 } 13398 }
13384 13399
13385 13400
13386 } } // namespace v8::internal 13401 } } // namespace v8::internal
OLDNEW
« src/assembler.cc ('K') | « src/ia32/macro-assembler-ia32.cc ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698