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

Side by Side Diff: src/objects.cc

Issue 2109593002: [regexp] Fix writing of lastIndex in JSRegExp::Initialize. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-349870.js » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 16023 matching lines...) Expand 10 before | Expand all | Expand 10 after
16034 16034
16035 Map* map = regexp->map(); 16035 Map* map = regexp->map();
16036 Object* constructor = map->GetConstructor(); 16036 Object* constructor = map->GetConstructor();
16037 if (constructor->IsJSFunction() && 16037 if (constructor->IsJSFunction() &&
16038 JSFunction::cast(constructor)->initial_map() == map) { 16038 JSFunction::cast(constructor)->initial_map() == map) {
16039 // If we still have the original map, set in-object properties directly. 16039 // If we still have the original map, set in-object properties directly.
16040 regexp->InObjectPropertyAtPut(JSRegExp::kLastIndexFieldIndex, 16040 regexp->InObjectPropertyAtPut(JSRegExp::kLastIndexFieldIndex,
16041 Smi::FromInt(0), SKIP_WRITE_BARRIER); 16041 Smi::FromInt(0), SKIP_WRITE_BARRIER);
16042 } else { 16042 } else {
16043 // Map has changed, so use generic, but slower, method. 16043 // Map has changed, so use generic, but slower, method.
16044 PropertyAttributes writable = 16044 RETURN_ON_EXCEPTION(
16045 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); 16045 isolate,
16046 JSObject::SetOwnPropertyIgnoreAttributes( 16046 JSReceiver::SetProperty(regexp, factory->last_index_string(),
16047 regexp, factory->last_index_string(), 16047 Handle<Smi>(Smi::FromInt(0), isolate), STRICT),
16048 Handle<Smi>(Smi::FromInt(0), isolate), writable) 16048 JSRegExp);
16049 .Check();
16050 } 16049 }
16051 16050
16052 return regexp; 16051 return regexp;
16053 } 16052 }
16054 16053
16055 16054
16056 // RegExpKey carries the source and flags of a regular expression as key. 16055 // RegExpKey carries the source and flags of a regular expression as key.
16057 class RegExpKey : public HashTableKey { 16056 class RegExpKey : public HashTableKey {
16058 public: 16057 public:
16059 RegExpKey(Handle<String> string, JSRegExp::Flags flags) 16058 RegExpKey(Handle<String> string, JSRegExp::Flags flags)
(...skipping 2890 matching lines...) Expand 10 before | Expand all | Expand 10 after
18950 18949
18951 Object* data_obj = 18950 Object* data_obj =
18952 constructor->shared()->get_api_func_data()->access_check_info(); 18951 constructor->shared()->get_api_func_data()->access_check_info();
18953 if (data_obj->IsUndefined(isolate)) return nullptr; 18952 if (data_obj->IsUndefined(isolate)) return nullptr;
18954 18953
18955 return AccessCheckInfo::cast(data_obj); 18954 return AccessCheckInfo::cast(data_obj);
18956 } 18955 }
18957 18956
18958 } // namespace internal 18957 } // namespace internal
18959 } // namespace v8 18958 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-349870.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698