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

Side by Side Diff: src/runtime.cc

Issue 227593003: Handlify RuntimeHidden_RegExpConstructResult. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix 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 | « no previous file | no next file » | 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 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after
2594 Handle<Object> result = RegExpImpl::Exec(regexp, 2594 Handle<Object> result = RegExpImpl::Exec(regexp,
2595 subject, 2595 subject,
2596 index, 2596 index,
2597 last_match_info); 2597 last_match_info);
2598 RETURN_IF_EMPTY_HANDLE(isolate, result); 2598 RETURN_IF_EMPTY_HANDLE(isolate, result);
2599 return *result; 2599 return *result;
2600 } 2600 }
2601 2601
2602 2602
2603 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_RegExpConstructResult) { 2603 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_RegExpConstructResult) {
2604 SealHandleScope shs(isolate); 2604 HandleScope handle_scope(isolate);
2605 ASSERT(args.length() == 3); 2605 ASSERT(args.length() == 3);
2606 CONVERT_SMI_ARG_CHECKED(elements_count, 0); 2606 CONVERT_SMI_ARG_CHECKED(size, 0);
2607 if (elements_count < 0 || 2607 RUNTIME_ASSERT(size >= 0 && size <= FixedArray::kMaxLength);
2608 elements_count > FixedArray::kMaxLength || 2608 Handle<FixedArray> elements = isolate->factory()->NewFixedArray(size);
2609 !Smi::IsValid(elements_count)) { 2609 Handle<Map> regexp_map(isolate->native_context()->regexp_result_map());
2610 return isolate->ThrowIllegalOperation(); 2610 Handle<JSObject> object =
2611 } 2611 isolate->factory()->NewJSObjectFromMap(regexp_map, NOT_TENURED, false);
2612 Object* new_object; 2612 Handle<JSArray> array = Handle<JSArray>::cast(object);
2613 { MaybeObject* maybe_new_object = 2613 array->set_elements(*elements);
2614 isolate->heap()->AllocateFixedArray(elements_count); 2614 array->set_length(Smi::FromInt(size));
2615 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object;
2616 }
2617 FixedArray* elements = FixedArray::cast(new_object);
2618 { MaybeObject* maybe_new_object = isolate->heap()->AllocateRaw(
2619 JSRegExpResult::kSize, NEW_SPACE, OLD_POINTER_SPACE);
2620 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object;
2621 }
2622 {
2623 DisallowHeapAllocation no_gc;
2624 HandleScope scope(isolate);
2625 reinterpret_cast<HeapObject*>(new_object)->
2626 set_map(isolate->native_context()->regexp_result_map());
2627 }
2628 JSArray* array = JSArray::cast(new_object);
2629 array->set_properties(isolate->heap()->empty_fixed_array());
2630 array->set_elements(elements);
2631 array->set_length(Smi::FromInt(elements_count));
2632 // Write in-object properties after the length of the array. 2615 // Write in-object properties after the length of the array.
2633 array->InObjectPropertyAtPut(JSRegExpResult::kIndexIndex, args[1]); 2616 array->InObjectPropertyAtPut(JSRegExpResult::kIndexIndex, args[1]);
2634 array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]); 2617 array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]);
2635 return array; 2618 return *array;
2636 } 2619 }
2637 2620
2638 2621
2639 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) { 2622 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
2640 HandleScope scope(isolate); 2623 HandleScope scope(isolate);
2641 ASSERT(args.length() == 5); 2624 ASSERT(args.length() == 5);
2642 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0); 2625 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
2643 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); 2626 CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
2644 // If source is the empty string we set it to "(?:)" instead as 2627 // If source is the empty string we set it to "(?:)" instead as
2645 // suggested by ECMA-262, 5th, section 15.10.4.1. 2628 // suggested by ECMA-262, 5th, section 15.10.4.1.
(...skipping 12615 matching lines...) Expand 10 before | Expand all | Expand 10 after
15261 } 15244 }
15262 } 15245 }
15263 15246
15264 15247
15265 void Runtime::OutOfMemory() { 15248 void Runtime::OutOfMemory() {
15266 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15249 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15267 UNREACHABLE(); 15250 UNREACHABLE();
15268 } 15251 }
15269 15252
15270 } } // namespace v8::internal 15253 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698