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

Side by Side Diff: src/accessors.cc

Issue 844193004: Correctly load RegExp.source from the holder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 | 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 // 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 375 }
376 } 376 }
377 377
378 378
379 // Implements ECMA262 ES6 draft 21.2.5.9 379 // Implements ECMA262 ES6 draft 21.2.5.9
380 void Accessors::RegExpSourceGetter( 380 void Accessors::RegExpSourceGetter(
381 v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { 381 v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
382 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); 382 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
383 HandleScope scope(isolate); 383 HandleScope scope(isolate);
384 384
385 Handle<Object> receiver = 385 Handle<Object> holder =
386 Utils::OpenHandle(*v8::Local<v8::Value>(info.This())); 386 Utils::OpenHandle(*v8::Local<v8::Value>(info.Holder()));
387 Handle<JSRegExp> regexp = Handle<JSRegExp>::cast(receiver); 387 Handle<JSRegExp> regexp = Handle<JSRegExp>::cast(holder);
388 Handle<String> result; 388 Handle<String> result;
389 if (regexp->TypeTag() == JSRegExp::NOT_COMPILED) { 389 if (regexp->TypeTag() == JSRegExp::NOT_COMPILED) {
390 result = isolate->factory()->empty_string(); 390 result = isolate->factory()->empty_string();
391 } else { 391 } else {
392 Handle<String> pattern(regexp->Pattern(), isolate); 392 Handle<String> pattern(regexp->Pattern(), isolate);
393 MaybeHandle<String> maybe = EscapeRegExpSource(isolate, pattern); 393 MaybeHandle<String> maybe = EscapeRegExpSource(isolate, pattern);
394 if (!maybe.ToHandle(&result)) { 394 if (!maybe.ToHandle(&result)) {
395 isolate->OptionalRescheduleException(false); 395 isolate->OptionalRescheduleException(false);
396 return; 396 return;
397 } 397 }
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 info->set_data(Smi::FromInt(index)); 1494 info->set_data(Smi::FromInt(index));
1495 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 1495 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1496 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 1496 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1497 info->set_getter(*getter); 1497 info->set_getter(*getter);
1498 if (!(attributes & ReadOnly)) info->set_setter(*setter); 1498 if (!(attributes & ReadOnly)) info->set_setter(*setter);
1499 return info; 1499 return info;
1500 } 1500 }
1501 1501
1502 1502
1503 } } // namespace v8::internal 1503 } } // 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