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

Side by Side Diff: src/objects.cc

Issue 1475823003: [runtime] First step to sanitize regexp literal creation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 15648 matching lines...) Expand 10 before | Expand all | Expand 10 after
15659 Handle<String> flags) { 15659 Handle<String> flags) {
15660 Isolate* isolate = pattern->GetIsolate(); 15660 Isolate* isolate = pattern->GetIsolate();
15661 Handle<JSFunction> constructor = isolate->regexp_function(); 15661 Handle<JSFunction> constructor = isolate->regexp_function();
15662 Handle<JSRegExp> regexp = 15662 Handle<JSRegExp> regexp =
15663 Handle<JSRegExp>::cast(isolate->factory()->NewJSObject(constructor)); 15663 Handle<JSRegExp>::cast(isolate->factory()->NewJSObject(constructor));
15664 15664
15665 return JSRegExp::Initialize(regexp, pattern, flags); 15665 return JSRegExp::Initialize(regexp, pattern, flags);
15666 } 15666 }
15667 15667
15668 15668
15669 // static
15670 Handle<JSRegExp> JSRegExp::Copy(Handle<JSRegExp> regexp) {
15671 Isolate* const isolate = regexp->GetIsolate();
15672 return Handle<JSRegExp>::cast(isolate->factory()->CopyJSObject(regexp));
15673 }
15674
15675
15669 static JSRegExp::Flags RegExpFlagsFromString(Handle<String> flags, 15676 static JSRegExp::Flags RegExpFlagsFromString(Handle<String> flags,
15670 bool* success) { 15677 bool* success) {
15671 uint32_t value = JSRegExp::NONE; 15678 uint32_t value = JSRegExp::NONE;
15672 int length = flags->length(); 15679 int length = flags->length();
15673 // A longer flags string cannot be valid. 15680 // A longer flags string cannot be valid.
15674 if (length > 5) return JSRegExp::Flags(0); 15681 if (length > 5) return JSRegExp::Flags(0);
15675 for (int i = 0; i < length; i++) { 15682 for (int i = 0; i < length; i++) {
15676 uint32_t flag = JSRegExp::NONE; 15683 uint32_t flag = JSRegExp::NONE;
15677 switch (flags->Get(i)) { 15684 switch (flags->Get(i)) {
15678 case 'g': 15685 case 'g':
(...skipping 2862 matching lines...) Expand 10 before | Expand all | Expand 10 after
18541 if (cell->value() != *new_value) { 18548 if (cell->value() != *new_value) {
18542 cell->set_value(*new_value); 18549 cell->set_value(*new_value);
18543 Isolate* isolate = cell->GetIsolate(); 18550 Isolate* isolate = cell->GetIsolate();
18544 cell->dependent_code()->DeoptimizeDependentCodeGroup( 18551 cell->dependent_code()->DeoptimizeDependentCodeGroup(
18545 isolate, DependentCode::kPropertyCellChangedGroup); 18552 isolate, DependentCode::kPropertyCellChangedGroup);
18546 } 18553 }
18547 } 18554 }
18548 18555
18549 } // namespace internal 18556 } // namespace internal
18550 } // namespace v8 18557 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698