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

Side by Side Diff: src/runtime.cc

Issue 153913002: A64: Synchronize with r16756. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/runtime.h ('k') | src/runtime-profiler.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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 if (*boilerplate == isolate->heap()->undefined_value()) { 492 if (*boilerplate == isolate->heap()->undefined_value()) {
493 boilerplate = CreateObjectLiteralBoilerplate(isolate, 493 boilerplate = CreateObjectLiteralBoilerplate(isolate,
494 literals, 494 literals,
495 constant_properties, 495 constant_properties,
496 should_have_fast_elements, 496 should_have_fast_elements,
497 has_function_literal); 497 has_function_literal);
498 RETURN_IF_EMPTY_HANDLE(isolate, boilerplate); 498 RETURN_IF_EMPTY_HANDLE(isolate, boilerplate);
499 // Update the functions literal and return the boilerplate. 499 // Update the functions literal and return the boilerplate.
500 literals->set(literals_index, *boilerplate); 500 literals->set(literals_index, *boilerplate);
501 } 501 }
502 return JSObject::cast(*boilerplate)->DeepCopy(isolate); 502
503 Handle<Object> copy = JSObject::DeepCopy(Handle<JSObject>::cast(boilerplate));
504 RETURN_IF_EMPTY_HANDLE(isolate, copy);
505 return *copy;
503 } 506 }
504 507
505 508
506 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) { 509 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) {
507 HandleScope scope(isolate); 510 HandleScope scope(isolate);
508 ASSERT(args.length() == 4); 511 ASSERT(args.length() == 4);
509 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 512 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
510 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 513 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
511 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); 514 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2);
512 CONVERT_SMI_ARG_CHECKED(flags, 3); 515 CONVERT_SMI_ARG_CHECKED(flags, 3);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 HandleScope scope(isolate); 560 HandleScope scope(isolate);
558 ASSERT(args.length() == 3); 561 ASSERT(args.length() == 3);
559 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 562 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
560 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 563 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
561 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); 564 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
562 565
563 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals, 566 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals,
564 literals_index, elements); 567 literals_index, elements);
565 RETURN_IF_EMPTY_HANDLE(isolate, site); 568 RETURN_IF_EMPTY_HANDLE(isolate, site);
566 569
567 JSObject* boilerplate = JSObject::cast(site->transition_info()); 570 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info()));
568 return boilerplate->DeepCopy(isolate); 571 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate);
572 RETURN_IF_EMPTY_HANDLE(isolate, copy);
573 return *copy;
569 } 574 }
570 575
571 576
572 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { 577 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) {
573 HandleScope scope(isolate); 578 HandleScope scope(isolate);
574 ASSERT(args.length() == 3); 579 ASSERT(args.length() == 3);
575 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 580 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
576 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 581 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
577 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); 582 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
578 583
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); 2274 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY);
2270 2275
2271 // Lookup the property locally in the global object. If it isn't 2276 // Lookup the property locally in the global object. If it isn't
2272 // there, we add the property and take special precautions to always 2277 // there, we add the property and take special precautions to always
2273 // add it as a local property even in case of callbacks in the 2278 // add it as a local property even in case of callbacks in the
2274 // prototype chain (this rules out using SetProperty). 2279 // prototype chain (this rules out using SetProperty).
2275 // We use SetLocalPropertyIgnoreAttributes instead 2280 // We use SetLocalPropertyIgnoreAttributes instead
2276 LookupResult lookup(isolate); 2281 LookupResult lookup(isolate);
2277 global->LocalLookup(*name, &lookup); 2282 global->LocalLookup(*name, &lookup);
2278 if (!lookup.IsFound()) { 2283 if (!lookup.IsFound()) {
2279 return global->SetLocalPropertyIgnoreAttributes(*name, 2284 HandleScope handle_scope(isolate);
2280 *value, 2285 Handle<GlobalObject> global(isolate->context()->global_object());
2281 attributes); 2286 RETURN_IF_EMPTY_HANDLE(
2287 isolate,
2288 JSObject::SetLocalPropertyIgnoreAttributes(global, name, value,
2289 attributes));
2290 return *value;
2282 } 2291 }
2283 2292
2284 if (!lookup.IsReadOnly()) { 2293 if (!lookup.IsReadOnly()) {
2285 // Restore global object from context (in case of GC) and continue 2294 // Restore global object from context (in case of GC) and continue
2286 // with setting the value. 2295 // with setting the value.
2287 HandleScope handle_scope(isolate); 2296 HandleScope handle_scope(isolate);
2288 Handle<GlobalObject> global(isolate->context()->global_object()); 2297 Handle<GlobalObject> global(isolate->context()->global_object());
2289 2298
2290 // BUG 1213575: Handle the case where we have to set a read-only 2299 // BUG 1213575: Handle the case where we have to set a read-only
2291 // property through an interceptor and only do it if it's 2300 // property through an interceptor and only do it if it's
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 array->set_elements(elements); 2497 array->set_elements(elements);
2489 array->set_length(Smi::FromInt(elements_count)); 2498 array->set_length(Smi::FromInt(elements_count));
2490 // Write in-object properties after the length of the array. 2499 // Write in-object properties after the length of the array.
2491 array->InObjectPropertyAtPut(JSRegExpResult::kIndexIndex, args[1]); 2500 array->InObjectPropertyAtPut(JSRegExpResult::kIndexIndex, args[1]);
2492 array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]); 2501 array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]);
2493 return array; 2502 return array;
2494 } 2503 }
2495 2504
2496 2505
2497 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) { 2506 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
2498 SealHandleScope shs(isolate); 2507 HandleScope scope(isolate);
2499 DisallowHeapAllocation no_allocation; 2508 DisallowHeapAllocation no_allocation;
2500 ASSERT(args.length() == 5); 2509 ASSERT(args.length() == 5);
2501 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); 2510 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
2502 CONVERT_ARG_CHECKED(String, source, 1); 2511 CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
2503 // If source is the empty string we set it to "(?:)" instead as 2512 // If source is the empty string we set it to "(?:)" instead as
2504 // suggested by ECMA-262, 5th, section 15.10.4.1. 2513 // suggested by ECMA-262, 5th, section 15.10.4.1.
2505 if (source->length() == 0) source = isolate->heap()->query_colon_string(); 2514 if (source->length() == 0) source = isolate->factory()->query_colon_string();
2506 2515
2507 Object* global = args[2]; 2516 CONVERT_ARG_HANDLE_CHECKED(Object, global, 2);
2508 if (!global->IsTrue()) global = isolate->heap()->false_value(); 2517 if (!global->IsTrue()) global = isolate->factory()->false_value();
2509 2518
2510 Object* ignoreCase = args[3]; 2519 CONVERT_ARG_HANDLE_CHECKED(Object, ignoreCase, 3);
2511 if (!ignoreCase->IsTrue()) ignoreCase = isolate->heap()->false_value(); 2520 if (!ignoreCase->IsTrue()) ignoreCase = isolate->factory()->false_value();
2512 2521
2513 Object* multiline = args[4]; 2522 CONVERT_ARG_HANDLE_CHECKED(Object, multiline, 4);
2514 if (!multiline->IsTrue()) multiline = isolate->heap()->false_value(); 2523 if (!multiline->IsTrue()) multiline = isolate->factory()->false_value();
2515 2524
2516 Map* map = regexp->map(); 2525 Map* map = regexp->map();
2517 Object* constructor = map->constructor(); 2526 Object* constructor = map->constructor();
2518 if (constructor->IsJSFunction() && 2527 if (constructor->IsJSFunction() &&
2519 JSFunction::cast(constructor)->initial_map() == map) { 2528 JSFunction::cast(constructor)->initial_map() == map) {
2520 // If we still have the original map, set in-object properties directly. 2529 // If we still have the original map, set in-object properties directly.
2521 regexp->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex, source); 2530 regexp->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex, *source);
2522 // Both true and false are immovable immortal objects so no need for write 2531 // Both true and false are immovable immortal objects so no need for write
2523 // barrier. 2532 // barrier.
2524 regexp->InObjectPropertyAtPut( 2533 regexp->InObjectPropertyAtPut(
2525 JSRegExp::kGlobalFieldIndex, global, SKIP_WRITE_BARRIER); 2534 JSRegExp::kGlobalFieldIndex, *global, SKIP_WRITE_BARRIER);
2526 regexp->InObjectPropertyAtPut( 2535 regexp->InObjectPropertyAtPut(
2527 JSRegExp::kIgnoreCaseFieldIndex, ignoreCase, SKIP_WRITE_BARRIER); 2536 JSRegExp::kIgnoreCaseFieldIndex, *ignoreCase, SKIP_WRITE_BARRIER);
2528 regexp->InObjectPropertyAtPut( 2537 regexp->InObjectPropertyAtPut(
2529 JSRegExp::kMultilineFieldIndex, multiline, SKIP_WRITE_BARRIER); 2538 JSRegExp::kMultilineFieldIndex, *multiline, SKIP_WRITE_BARRIER);
2530 regexp->InObjectPropertyAtPut( 2539 regexp->InObjectPropertyAtPut(
2531 JSRegExp::kLastIndexFieldIndex, Smi::FromInt(0), SKIP_WRITE_BARRIER); 2540 JSRegExp::kLastIndexFieldIndex, Smi::FromInt(0), SKIP_WRITE_BARRIER);
2532 return regexp; 2541 return *regexp;
2533 } 2542 }
2534 2543
2535 // Map has changed, so use generic, but slower, method. 2544 // Map has changed, so use generic, but slower, method.
2536 PropertyAttributes final = 2545 PropertyAttributes final =
2537 static_cast<PropertyAttributes>(READ_ONLY | DONT_ENUM | DONT_DELETE); 2546 static_cast<PropertyAttributes>(READ_ONLY | DONT_ENUM | DONT_DELETE);
2538 PropertyAttributes writable = 2547 PropertyAttributes writable =
2539 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); 2548 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
2540 Heap* heap = isolate->heap(); 2549 Handle<Object> zero(Smi::FromInt(0), isolate);
2541 MaybeObject* result; 2550 Factory* factory = isolate->factory();
2542 result = regexp->SetLocalPropertyIgnoreAttributes(heap->source_string(), 2551 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes(
2543 source, 2552 regexp, factory->source_string(), source, final));
2544 final); 2553 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes(
2545 // TODO(jkummerow): Turn these back into ASSERTs when we can be certain 2554 regexp, factory->global_string(), global, final));
2546 // that it never fires in Release mode in the wild. 2555 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes(
2547 CHECK(!result->IsFailure()); 2556 regexp, factory->ignore_case_string(), ignoreCase, final));
2548 result = regexp->SetLocalPropertyIgnoreAttributes(heap->global_string(), 2557 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes(
2549 global, 2558 regexp, factory->multiline_string(), multiline, final));
2550 final); 2559 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes(
2551 CHECK(!result->IsFailure()); 2560 regexp, factory->last_index_string(), zero, writable));
2552 result = 2561 return *regexp;
2553 regexp->SetLocalPropertyIgnoreAttributes(heap->ignore_case_string(),
2554 ignoreCase,
2555 final);
2556 CHECK(!result->IsFailure());
2557 result = regexp->SetLocalPropertyIgnoreAttributes(heap->multiline_string(),
2558 multiline,
2559 final);
2560 CHECK(!result->IsFailure());
2561 result =
2562 regexp->SetLocalPropertyIgnoreAttributes(heap->last_index_string(),
2563 Smi::FromInt(0),
2564 writable);
2565 CHECK(!result->IsFailure());
2566 USE(result);
2567 return regexp;
2568 } 2562 }
2569 2563
2570 2564
2571 RUNTIME_FUNCTION(MaybeObject*, Runtime_FinishArrayPrototypeSetup) { 2565 RUNTIME_FUNCTION(MaybeObject*, Runtime_FinishArrayPrototypeSetup) {
2572 HandleScope scope(isolate); 2566 HandleScope scope(isolate);
2573 ASSERT(args.length() == 1); 2567 ASSERT(args.length() == 1);
2574 CONVERT_ARG_HANDLE_CHECKED(JSArray, prototype, 0); 2568 CONVERT_ARG_HANDLE_CHECKED(JSArray, prototype, 0);
2575 // This is necessary to enable fast checks for absence of elements 2569 // This is necessary to enable fast checks for absence of elements
2576 // on Array.prototype and below. 2570 // on Array.prototype and below.
2577 prototype->set_elements(isolate->heap()->empty_fixed_array()); 2571 prototype->set_elements(isolate->heap()->empty_fixed_array());
(...skipping 2479 matching lines...) Expand 10 before | Expand all | Expand 10 after
5057 (attr != result.GetAttributes() || result.IsPropertyCallbacks())) { 5051 (attr != result.GetAttributes() || result.IsPropertyCallbacks())) {
5058 // New attributes - normalize to avoid writing to instance descriptor 5052 // New attributes - normalize to avoid writing to instance descriptor
5059 if (js_object->IsJSGlobalProxy()) { 5053 if (js_object->IsJSGlobalProxy()) {
5060 // Since the result is a property, the prototype will exist so 5054 // Since the result is a property, the prototype will exist so
5061 // we don't have to check for null. 5055 // we don't have to check for null.
5062 js_object = Handle<JSObject>(JSObject::cast(js_object->GetPrototype())); 5056 js_object = Handle<JSObject>(JSObject::cast(js_object->GetPrototype()));
5063 } 5057 }
5064 JSObject::NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0); 5058 JSObject::NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0);
5065 // Use IgnoreAttributes version since a readonly property may be 5059 // Use IgnoreAttributes version since a readonly property may be
5066 // overridden and SetProperty does not allow this. 5060 // overridden and SetProperty does not allow this.
5067 return js_object->SetLocalPropertyIgnoreAttributes(*name, 5061 Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes(
5068 *obj_value, 5062 js_object, name, obj_value, attr);
5069 attr); 5063 RETURN_IF_EMPTY_HANDLE(isolate, result);
5064 return *result;
5070 } 5065 }
5071 5066
5072 return Runtime::ForceSetObjectProperty(isolate, 5067 return Runtime::ForceSetObjectProperty(isolate,
5073 js_object, 5068 js_object,
5074 name, 5069 name,
5075 obj_value, 5070 obj_value,
5076 attr); 5071 attr);
5077 } 5072 }
5078 5073
5079 5074
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
5245 index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY); 5240 index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY);
5246 } 5241 }
5247 5242
5248 if (key->IsName()) { 5243 if (key->IsName()) {
5249 Handle<Name> name = Handle<Name>::cast(key); 5244 Handle<Name> name = Handle<Name>::cast(key);
5250 if (name->AsArrayIndex(&index)) { 5245 if (name->AsArrayIndex(&index)) {
5251 return js_object->SetElement( 5246 return js_object->SetElement(
5252 index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY); 5247 index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY);
5253 } else { 5248 } else {
5254 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); 5249 if (name->IsString()) Handle<String>::cast(name)->TryFlatten();
5255 return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr); 5250 Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes(
5251 js_object, name, value, attr);
5252 RETURN_IF_EMPTY_HANDLE(isolate, result);
5253 return *result;
5256 } 5254 }
5257 } 5255 }
5258 5256
5259 // Call-back into JavaScript to convert the key to a string. 5257 // Call-back into JavaScript to convert the key to a string.
5260 bool has_pending_exception = false; 5258 bool has_pending_exception = false;
5261 Handle<Object> converted = 5259 Handle<Object> converted =
5262 Execution::ToString(isolate, key, &has_pending_exception); 5260 Execution::ToString(isolate, key, &has_pending_exception);
5263 if (has_pending_exception) return Failure::Exception(); 5261 if (has_pending_exception) return Failure::Exception();
5264 Handle<String> name = Handle<String>::cast(converted); 5262 Handle<String> name = Handle<String>::cast(converted);
5265 5263
5266 if (name->AsArrayIndex(&index)) { 5264 if (name->AsArrayIndex(&index)) {
5267 return js_object->SetElement( 5265 return js_object->SetElement(
5268 index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY); 5266 index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY);
5269 } else { 5267 } else {
5270 return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr); 5268 Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes(
5269 js_object, name, value, attr);
5270 RETURN_IF_EMPTY_HANDLE(isolate, result);
5271 return *result;
5271 } 5272 }
5272 } 5273 }
5273 5274
5274 5275
5275 MaybeObject* Runtime::DeleteObjectProperty(Isolate* isolate, 5276 MaybeObject* Runtime::DeleteObjectProperty(Isolate* isolate,
5276 Handle<JSReceiver> receiver, 5277 Handle<JSReceiver> receiver,
5277 Handle<Object> key, 5278 Handle<Object> key,
5278 JSReceiver::DeleteMode mode) { 5279 JSReceiver::DeleteMode mode) {
5279 HandleScope scope(isolate); 5280 HandleScope scope(isolate);
5280 5281
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
5463 debug->ClearStepOut(); 5464 debug->ClearStepOut();
5464 debug->FloodWithOneShot(callback); 5465 debug->FloodWithOneShot(callback);
5465 #endif // ENABLE_DEBUGGER_SUPPORT 5466 #endif // ENABLE_DEBUGGER_SUPPORT
5466 return isolate->heap()->undefined_value(); 5467 return isolate->heap()->undefined_value();
5467 } 5468 }
5468 5469
5469 5470
5470 // Set a local property, even if it is READ_ONLY. If the property does not 5471 // Set a local property, even if it is READ_ONLY. If the property does not
5471 // exist, it will be added with attributes NONE. 5472 // exist, it will be added with attributes NONE.
5472 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { 5473 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) {
5473 SealHandleScope shs(isolate); 5474 HandleScope scope(isolate);
5474 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4); 5475 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4);
5475 CONVERT_ARG_CHECKED(JSObject, object, 0); 5476 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
5476 CONVERT_ARG_CHECKED(Name, name, 1); 5477 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
5478 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
5477 // Compute attributes. 5479 // Compute attributes.
5478 PropertyAttributes attributes = NONE; 5480 PropertyAttributes attributes = NONE;
5479 if (args.length() == 4) { 5481 if (args.length() == 4) {
5480 CONVERT_SMI_ARG_CHECKED(unchecked_value, 3); 5482 CONVERT_SMI_ARG_CHECKED(unchecked_value, 3);
5481 // Only attribute bits should be set. 5483 // Only attribute bits should be set.
5482 RUNTIME_ASSERT( 5484 RUNTIME_ASSERT(
5483 (unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); 5485 (unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
5484 attributes = static_cast<PropertyAttributes>(unchecked_value); 5486 attributes = static_cast<PropertyAttributes>(unchecked_value);
5485 } 5487 }
5486 5488 Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes(
5487 return object-> 5489 object, name, value, attributes);
5488 SetLocalPropertyIgnoreAttributes(name, args[2], attributes); 5490 RETURN_IF_EMPTY_HANDLE(isolate, result);
5491 return *result;
5489 } 5492 }
5490 5493
5491 5494
5492 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteProperty) { 5495 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteProperty) {
5493 HandleScope scope(isolate); 5496 HandleScope scope(isolate);
5494 ASSERT(args.length() == 3); 5497 ASSERT(args.length() == 3);
5495 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); 5498 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
5496 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); 5499 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
5497 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 2); 5500 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 2);
5498 JSReceiver::DeleteMode delete_mode = (strict_mode == kStrictMode) 5501 JSReceiver::DeleteMode delete_mode = (strict_mode == kStrictMode)
(...skipping 2840 matching lines...) Expand 10 before | Expand all | Expand 10 after
8339 } 8342 }
8340 function->shared()->code()->set_profiler_ticks(0); 8343 function->shared()->code()->set_profiler_ticks(0);
8341 ASSERT(FLAG_concurrent_recompilation); 8344 ASSERT(FLAG_concurrent_recompilation);
8342 if (!Compiler::RecompileConcurrent(function)) { 8345 if (!Compiler::RecompileConcurrent(function)) {
8343 function->ReplaceCode(function->shared()->code()); 8346 function->ReplaceCode(function->shared()->code());
8344 } 8347 }
8345 return isolate->heap()->undefined_value(); 8348 return isolate->heap()->undefined_value();
8346 } 8349 }
8347 8350
8348 8351
8349 RUNTIME_FUNCTION(MaybeObject*, Runtime_InstallRecompiledCode) {
8350 HandleScope handle_scope(isolate);
8351 ASSERT(args.length() == 1);
8352 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8353 ASSERT(isolate->use_crankshaft() && FLAG_concurrent_recompilation);
8354 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions();
8355 return function->code();
8356 }
8357
8358
8359 class ActivationsFinder : public ThreadVisitor { 8352 class ActivationsFinder : public ThreadVisitor {
8360 public: 8353 public:
8361 Code* code_; 8354 Code* code_;
8362 bool has_code_activations_; 8355 bool has_code_activations_;
8363 8356
8364 explicit ActivationsFinder(Code* code) 8357 explicit ActivationsFinder(Code* code)
8365 : code_(code), 8358 : code_(code),
8366 has_code_activations_(false) { } 8359 has_code_activations_(false) { }
8367 8360
8368 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { 8361 void VisitThread(Isolate* isolate, ThreadLocalTop* top) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
8546 } 8539 }
8547 bool sync_with_compiler_thread = true; 8540 bool sync_with_compiler_thread = true;
8548 if (args.length() == 2) { 8541 if (args.length() == 2) {
8549 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); 8542 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1);
8550 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { 8543 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) {
8551 sync_with_compiler_thread = false; 8544 sync_with_compiler_thread = false;
8552 } 8545 }
8553 } 8546 }
8554 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8547 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8555 if (FLAG_concurrent_recompilation && sync_with_compiler_thread) { 8548 if (FLAG_concurrent_recompilation && sync_with_compiler_thread) {
8556 while (function->IsInRecompileQueue() || 8549 while (function->IsInRecompileQueue()) {
8557 function->IsMarkedForInstallingRecompiledCode()) {
8558 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); 8550 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions();
8559 OS::Sleep(50); 8551 OS::Sleep(50);
8560 } 8552 }
8561 } 8553 }
8562 if (FLAG_always_opt) { 8554 if (FLAG_always_opt) {
8563 // We may have always opt, but that is more best-effort than a real 8555 // We may have always opt, but that is more best-effort than a real
8564 // promise, so we still say "no" if it is not optimized. 8556 // promise, so we still say "no" if it is not optimized.
8565 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". 8557 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always".
8566 : Smi::FromInt(2); // 2 == "no". 8558 : Smi::FromInt(2); // 2 == "no".
8567 } 8559 }
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
9375 } 9367 }
9376 9368
9377 9369
9378 9370
9379 RUNTIME_FUNCTION(MaybeObject*, Runtime_StackGuard) { 9371 RUNTIME_FUNCTION(MaybeObject*, Runtime_StackGuard) {
9380 SealHandleScope shs(isolate); 9372 SealHandleScope shs(isolate);
9381 ASSERT(args.length() == 0); 9373 ASSERT(args.length() == 0);
9382 9374
9383 // First check if this is a real stack overflow. 9375 // First check if this is a real stack overflow.
9384 if (isolate->stack_guard()->IsStackOverflow()) { 9376 if (isolate->stack_guard()->IsStackOverflow()) {
9385 SealHandleScope shs(isolate);
9386 return isolate->StackOverflow(); 9377 return isolate->StackOverflow();
9387 } 9378 }
9388 9379
9389 return Execution::HandleStackGuardInterrupt(isolate); 9380 return Execution::HandleStackGuardInterrupt(isolate);
9390 } 9381 }
9391 9382
9392 9383
9384 RUNTIME_FUNCTION(MaybeObject*, Runtime_TryInstallRecompiledCode) {
9385 HandleScope scope(isolate);
9386 ASSERT(args.length() == 1);
9387 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
9388
9389 // First check if this is a real stack overflow.
9390 if (isolate->stack_guard()->IsStackOverflow()) {
9391 SealHandleScope shs(isolate);
9392 return isolate->StackOverflow();
9393 }
9394
9395 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions();
9396 return (function->IsOptimized()) ? function->code()
9397 : function->shared()->code();
9398 }
9399
9400
9393 RUNTIME_FUNCTION(MaybeObject*, Runtime_Interrupt) { 9401 RUNTIME_FUNCTION(MaybeObject*, Runtime_Interrupt) {
9394 SealHandleScope shs(isolate); 9402 SealHandleScope shs(isolate);
9395 ASSERT(args.length() == 0); 9403 ASSERT(args.length() == 0);
9396 return Execution::HandleStackGuardInterrupt(isolate); 9404 return Execution::HandleStackGuardInterrupt(isolate);
9397 } 9405 }
9398 9406
9399 9407
9400 static int StackSize(Isolate* isolate) { 9408 static int StackSize(Isolate* isolate) {
9401 int n = 0; 9409 int n = 0;
9402 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) n++; 9410 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) n++;
(...skipping 5373 matching lines...) Expand 10 before | Expand all | Expand 10 after
14776 } 14784 }
14777 return NULL; 14785 return NULL;
14778 } 14786 }
14779 14787
14780 14788
14781 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 14789 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
14782 return &(kIntrinsicFunctions[static_cast<int>(id)]); 14790 return &(kIntrinsicFunctions[static_cast<int>(id)]);
14783 } 14791 }
14784 14792
14785 14793
14786 void Runtime::PerformGC(Object* result) { 14794 void Runtime::PerformGC(Object* result, Isolate* isolate) {
14787 Isolate* isolate = Isolate::Current();
14788 Failure* failure = Failure::cast(result); 14795 Failure* failure = Failure::cast(result);
14789 if (failure->IsRetryAfterGC()) { 14796 if (failure->IsRetryAfterGC()) {
14790 if (isolate->heap()->new_space()->AddFreshPage()) { 14797 if (isolate->heap()->new_space()->AddFreshPage()) {
14791 return; 14798 return;
14792 } 14799 }
14793 14800
14794 // Try to do a garbage collection; ignore it if it fails. The C 14801 // Try to do a garbage collection; ignore it if it fails. The C
14795 // entry stub will throw an out-of-memory exception in that case. 14802 // entry stub will throw an out-of-memory exception in that case.
14796 isolate->heap()->CollectGarbage(failure->allocation_space(), 14803 isolate->heap()->CollectGarbage(failure->allocation_space(),
14797 "Runtime::PerformGC"); 14804 "Runtime::PerformGC");
14798 } else { 14805 } else {
14799 // Handle last resort GC and make sure to allow future allocations 14806 // Handle last resort GC and make sure to allow future allocations
14800 // to grow the heap without causing GCs (if possible). 14807 // to grow the heap without causing GCs (if possible).
14801 isolate->counters()->gc_last_resort_from_js()->Increment(); 14808 isolate->counters()->gc_last_resort_from_js()->Increment();
14802 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14809 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14803 "Runtime::PerformGC"); 14810 "Runtime::PerformGC");
14804 } 14811 }
14805 } 14812 }
14806 14813
14807 14814
14808 } } // namespace v8::internal 14815 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698