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

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
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/serialize.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 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 isolate->factory()->NewJSObjectFromMap(
239 map, isolate->heap()->GetPretenureMode());
238 240
239 // Normalize the elements of the boilerplate to save space if needed. 241 // Normalize the elements of the boilerplate to save space if needed.
240 if (!should_have_fast_elements) JSObject::NormalizeElements(boilerplate); 242 if (!should_have_fast_elements) JSObject::NormalizeElements(boilerplate);
241 243
242 // Add the constant properties to the boilerplate. 244 // Add the constant properties to the boilerplate.
243 int length = constant_properties->length(); 245 int length = constant_properties->length();
244 bool should_transform = 246 bool should_transform =
245 !is_result_from_cache && boilerplate->HasFastProperties(); 247 !is_result_from_cache && boilerplate->HasFastProperties();
246 if (should_transform || has_function_literal) { 248 if (should_transform || has_function_literal) {
247 // Normalize the properties of object to avoid n^2 behavior 249 // 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; 333 static const int kSmiLiteralMinimumLength = 1024;
332 334
333 335
334 Handle<Object> Runtime::CreateArrayLiteralBoilerplate( 336 Handle<Object> Runtime::CreateArrayLiteralBoilerplate(
335 Isolate* isolate, 337 Isolate* isolate,
336 Handle<FixedArray> literals, 338 Handle<FixedArray> literals,
337 Handle<FixedArray> elements) { 339 Handle<FixedArray> elements) {
338 // Create the JSArray. 340 // Create the JSArray.
339 Handle<JSFunction> constructor( 341 Handle<JSFunction> constructor(
340 JSFunction::NativeContextFromLiterals(*literals)->array_function()); 342 JSFunction::NativeContextFromLiterals(*literals)->array_function());
341 Handle<JSArray> object = 343
342 Handle<JSArray>::cast(isolate->factory()->NewJSObject(constructor)); 344 Handle<JSArray> object = Handle<JSArray>::cast(
345 isolate->factory()->NewJSObject(
346 constructor, isolate->heap()->GetPretenureMode()));
343 347
344 ElementsKind constant_elements_kind = 348 ElementsKind constant_elements_kind =
345 static_cast<ElementsKind>(Smi::cast(elements->get(0))->value()); 349 static_cast<ElementsKind>(Smi::cast(elements->get(0))->value());
346 Handle<FixedArrayBase> constant_elements_values( 350 Handle<FixedArrayBase> constant_elements_values(
347 FixedArrayBase::cast(elements->get(1))); 351 FixedArrayBase::cast(elements->get(1)));
348 352
349 ASSERT(IsFastElementsKind(constant_elements_kind)); 353 ASSERT(IsFastElementsKind(constant_elements_kind));
350 Context* native_context = isolate->context()->native_context(); 354 Context* native_context = isolate->context()->native_context();
351 Object* maybe_maps_array = native_context->js_array_maps(); 355 Object* maybe_maps_array = native_context->js_array_maps();
352 ASSERT(!maybe_maps_array->IsUndefined()); 356 ASSERT(!maybe_maps_array->IsUndefined());
(...skipping 5771 matching lines...) Expand 10 before | Expand all | Expand 10 after
6124 } 6128 }
6125 6129
6126 6130
6127 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToStringSkipCache) { 6131 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToStringSkipCache) {
6128 NoHandleAllocation ha(isolate); 6132 NoHandleAllocation ha(isolate);
6129 ASSERT(args.length() == 1); 6133 ASSERT(args.length() == 1);
6130 6134
6131 Object* number = args[0]; 6135 Object* number = args[0];
6132 RUNTIME_ASSERT(number->IsNumber()); 6136 RUNTIME_ASSERT(number->IsNumber());
6133 6137
6134 return isolate->heap()->NumberToString(number, false); 6138 return isolate->heap()->NumberToString(
6139 number, false, isolate->heap()->GetPretenureMode());
6135 } 6140 }
6136 6141
6137 6142
6138 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToInteger) { 6143 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToInteger) {
6139 NoHandleAllocation ha(isolate); 6144 NoHandleAllocation ha(isolate);
6140 ASSERT(args.length() == 1); 6145 ASSERT(args.length() == 1);
6141 6146
6142 CONVERT_DOUBLE_ARG_CHECKED(number, 0); 6147 CONVERT_DOUBLE_ARG_CHECKED(number, 0);
6143 6148
6144 // We do not include 0 so that we don't have to treat +0 / -0 cases. 6149 // We do not include 0 so that we don't have to treat +0 / -0 cases.
(...skipping 7232 matching lines...) Expand 10 before | Expand all | Expand 10 after
13377 // Handle last resort GC and make sure to allow future allocations 13382 // Handle last resort GC and make sure to allow future allocations
13378 // to grow the heap without causing GCs (if possible). 13383 // to grow the heap without causing GCs (if possible).
13379 isolate->counters()->gc_last_resort_from_js()->Increment(); 13384 isolate->counters()->gc_last_resort_from_js()->Increment();
13380 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13385 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13381 "Runtime::PerformGC"); 13386 "Runtime::PerformGC");
13382 } 13387 }
13383 } 13388 }
13384 13389
13385 13390
13386 } } // namespace v8::internal 13391 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « 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