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

Side by Side Diff: src/factory.cc

Issue 1472323002: [es6] Correct parsing of regular expression literal flags. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix oversight in interpreter 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
« no previous file with comments | « src/ast.h ('k') | src/full-codegen/arm/full-codegen-arm.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 2290
2291 void Factory::SetRegExpAtomData(Handle<JSRegExp> regexp, 2291 void Factory::SetRegExpAtomData(Handle<JSRegExp> regexp,
2292 JSRegExp::Type type, 2292 JSRegExp::Type type,
2293 Handle<String> source, 2293 Handle<String> source,
2294 JSRegExp::Flags flags, 2294 JSRegExp::Flags flags,
2295 Handle<Object> data) { 2295 Handle<Object> data) {
2296 Handle<FixedArray> store = NewFixedArray(JSRegExp::kAtomDataSize); 2296 Handle<FixedArray> store = NewFixedArray(JSRegExp::kAtomDataSize);
2297 2297
2298 store->set(JSRegExp::kTagIndex, Smi::FromInt(type)); 2298 store->set(JSRegExp::kTagIndex, Smi::FromInt(type));
2299 store->set(JSRegExp::kSourceIndex, *source); 2299 store->set(JSRegExp::kSourceIndex, *source);
2300 store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value())); 2300 store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags));
2301 store->set(JSRegExp::kAtomPatternIndex, *data); 2301 store->set(JSRegExp::kAtomPatternIndex, *data);
2302 regexp->set_data(*store); 2302 regexp->set_data(*store);
2303 } 2303 }
2304 2304
2305 2305
2306 void Factory::SetRegExpIrregexpData(Handle<JSRegExp> regexp, 2306 void Factory::SetRegExpIrregexpData(Handle<JSRegExp> regexp,
2307 JSRegExp::Type type, 2307 JSRegExp::Type type,
2308 Handle<String> source, 2308 Handle<String> source,
2309 JSRegExp::Flags flags, 2309 JSRegExp::Flags flags,
2310 int capture_count) { 2310 int capture_count) {
2311 Handle<FixedArray> store = NewFixedArray(JSRegExp::kIrregexpDataSize); 2311 Handle<FixedArray> store = NewFixedArray(JSRegExp::kIrregexpDataSize);
2312 Smi* uninitialized = Smi::FromInt(JSRegExp::kUninitializedValue); 2312 Smi* uninitialized = Smi::FromInt(JSRegExp::kUninitializedValue);
2313 store->set(JSRegExp::kTagIndex, Smi::FromInt(type)); 2313 store->set(JSRegExp::kTagIndex, Smi::FromInt(type));
2314 store->set(JSRegExp::kSourceIndex, *source); 2314 store->set(JSRegExp::kSourceIndex, *source);
2315 store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value())); 2315 store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags));
2316 store->set(JSRegExp::kIrregexpLatin1CodeIndex, uninitialized); 2316 store->set(JSRegExp::kIrregexpLatin1CodeIndex, uninitialized);
2317 store->set(JSRegExp::kIrregexpUC16CodeIndex, uninitialized); 2317 store->set(JSRegExp::kIrregexpUC16CodeIndex, uninitialized);
2318 store->set(JSRegExp::kIrregexpLatin1CodeSavedIndex, uninitialized); 2318 store->set(JSRegExp::kIrregexpLatin1CodeSavedIndex, uninitialized);
2319 store->set(JSRegExp::kIrregexpUC16CodeSavedIndex, uninitialized); 2319 store->set(JSRegExp::kIrregexpUC16CodeSavedIndex, uninitialized);
2320 store->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::FromInt(0)); 2320 store->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::FromInt(0));
2321 store->set(JSRegExp::kIrregexpCaptureCountIndex, 2321 store->set(JSRegExp::kIrregexpCaptureCountIndex,
2322 Smi::FromInt(capture_count)); 2322 Smi::FromInt(capture_count));
2323 regexp->set_data(*store); 2323 regexp->set_data(*store);
2324 } 2324 }
2325 2325
2326 2326
2327 Handle<Object> Factory::GlobalConstantFor(Handle<Name> name) { 2327 Handle<Object> Factory::GlobalConstantFor(Handle<Name> name) {
2328 if (Name::Equals(name, undefined_string())) return undefined_value(); 2328 if (Name::Equals(name, undefined_string())) return undefined_value();
2329 if (Name::Equals(name, nan_string())) return nan_value(); 2329 if (Name::Equals(name, nan_string())) return nan_value();
2330 if (Name::Equals(name, infinity_string())) return infinity_value(); 2330 if (Name::Equals(name, infinity_string())) return infinity_value();
2331 return Handle<Object>::null(); 2331 return Handle<Object>::null();
2332 } 2332 }
2333 2333
2334 2334
2335 Handle<Object> Factory::ToBoolean(bool value) { 2335 Handle<Object> Factory::ToBoolean(bool value) {
2336 return value ? true_value() : false_value(); 2336 return value ? true_value() : false_value();
2337 } 2337 }
2338 2338
2339 2339
2340 } // namespace internal 2340 } // namespace internal
2341 } // namespace v8 2341 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698