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

Side by Side Diff: src/runtime/runtime-literals.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/regexp/jsregexp.cc ('k') | src/runtime/runtime-regexp.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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 235 }
236 } 236 }
237 237
238 238
239 RUNTIME_FUNCTION(Runtime_CreateRegExpLiteral) { 239 RUNTIME_FUNCTION(Runtime_CreateRegExpLiteral) {
240 HandleScope scope(isolate); 240 HandleScope scope(isolate);
241 DCHECK_EQ(4, args.length()); 241 DCHECK_EQ(4, args.length());
242 CONVERT_ARG_HANDLE_CHECKED(JSFunction, closure, 0); 242 CONVERT_ARG_HANDLE_CHECKED(JSFunction, closure, 0);
243 CONVERT_SMI_ARG_CHECKED(index, 1); 243 CONVERT_SMI_ARG_CHECKED(index, 1);
244 CONVERT_ARG_HANDLE_CHECKED(String, pattern, 2); 244 CONVERT_ARG_HANDLE_CHECKED(String, pattern, 2);
245 CONVERT_ARG_HANDLE_CHECKED(String, flags, 3); 245 CONVERT_SMI_ARG_CHECKED(flags, 3);
246 246
247 // Check if boilerplate exists. If not, create it first. 247 // Check if boilerplate exists. If not, create it first.
248 Handle<Object> boilerplate(closure->literals()->literal(index), isolate); 248 Handle<Object> boilerplate(closure->literals()->literal(index), isolate);
249 if (boilerplate->IsUndefined()) { 249 if (boilerplate->IsUndefined()) {
250 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, boilerplate, 250 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
251 JSRegExp::New(pattern, flags)); 251 isolate, boilerplate, JSRegExp::New(pattern, JSRegExp::Flags(flags)));
252 closure->literals()->set_literal(index, *boilerplate); 252 closure->literals()->set_literal(index, *boilerplate);
253 } 253 }
254 return *JSRegExp::Copy(Handle<JSRegExp>::cast(boilerplate)); 254 return *JSRegExp::Copy(Handle<JSRegExp>::cast(boilerplate));
255 } 255 }
256 256
257 257
258 RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) { 258 RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) {
259 HandleScope scope(isolate); 259 HandleScope scope(isolate);
260 DCHECK_EQ(4, args.length()); 260 DCHECK_EQ(4, args.length());
261 CONVERT_ARG_HANDLE_CHECKED(JSFunction, closure, 0); 261 CONVERT_ARG_HANDLE_CHECKED(JSFunction, closure, 0);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind); 451 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind);
452 } 452 }
453 } 453 }
454 FixedArray* object_array = FixedArray::cast(object->elements()); 454 FixedArray* object_array = FixedArray::cast(object->elements());
455 object_array->set(store_index, *value); 455 object_array->set(store_index, *value);
456 } 456 }
457 return *object; 457 return *object;
458 } 458 }
459 } // namespace internal 459 } // namespace internal
460 } // namespace v8 460 } // namespace v8
OLDNEW
« no previous file with comments | « src/regexp/jsregexp.cc ('k') | src/runtime/runtime-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698