| OLD | NEW |
| 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 (function(global, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
| 8 | 8 |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 // Imports | 10 // Imports |
| 11 | 11 |
| 12 var FLAG_harmony_regexps; | 12 var FLAG_harmony_regexps; |
| 13 var FLAG_harmony_tolength; | 13 var FLAG_harmony_tolength; |
| 14 var FLAG_harmony_unicode_regexps; | 14 var FLAG_harmony_unicode_regexps; |
| 15 var GlobalObject = global.Object; |
| 15 var GlobalRegExp = global.RegExp; | 16 var GlobalRegExp = global.RegExp; |
| 16 var InternalPackedArray = utils.InternalPackedArray; | 17 var InternalPackedArray = utils.InternalPackedArray; |
| 17 var MakeTypeError; | 18 var MakeTypeError; |
| 18 | 19 |
| 19 utils.ImportFromExperimental(function(from) { | 20 utils.ImportFromExperimental(function(from) { |
| 20 FLAG_harmony_regexps = from.FLAG_harmony_regexps; | 21 FLAG_harmony_regexps = from.FLAG_harmony_regexps; |
| 21 FLAG_harmony_tolength = from.FLAG_harmony_tolength; | 22 FLAG_harmony_tolength = from.FLAG_harmony_tolength; |
| 22 FLAG_harmony_unicode_regexps = from.FLAG_harmony_unicode_regexps; | 23 FLAG_harmony_unicode_regexps = from.FLAG_harmony_unicode_regexps; |
| 23 }); | 24 }); |
| 24 | 25 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 var matchStart = RegExpLastMatchInfo[CAPTURE(index)]; | 330 var matchStart = RegExpLastMatchInfo[CAPTURE(index)]; |
| 330 var matchEnd = RegExpLastMatchInfo[CAPTURE(index + 1)]; | 331 var matchEnd = RegExpLastMatchInfo[CAPTURE(index + 1)]; |
| 331 if (matchStart == -1 || matchEnd == -1) return ''; | 332 if (matchStart == -1 || matchEnd == -1) return ''; |
| 332 return %_SubString(LAST_SUBJECT(RegExpLastMatchInfo), matchStart, matchEnd); | 333 return %_SubString(LAST_SUBJECT(RegExpLastMatchInfo), matchStart, matchEnd); |
| 333 }; | 334 }; |
| 334 } | 335 } |
| 335 | 336 |
| 336 // ------------------------------------------------------------------- | 337 // ------------------------------------------------------------------- |
| 337 | 338 |
| 338 %FunctionSetInstanceClassName(GlobalRegExp, 'RegExp'); | 339 %FunctionSetInstanceClassName(GlobalRegExp, 'RegExp'); |
| 340 %FunctionSetPrototype(GlobalRegExp, new GlobalObject()); |
| 339 %AddNamedProperty( | 341 %AddNamedProperty( |
| 340 GlobalRegExp.prototype, 'constructor', GlobalRegExp, DONT_ENUM); | 342 GlobalRegExp.prototype, 'constructor', GlobalRegExp, DONT_ENUM); |
| 341 %SetCode(GlobalRegExp, RegExpConstructor); | 343 %SetCode(GlobalRegExp, RegExpConstructor); |
| 342 | 344 |
| 343 utils.InstallFunctions(GlobalRegExp.prototype, DONT_ENUM, [ | 345 utils.InstallFunctions(GlobalRegExp.prototype, DONT_ENUM, [ |
| 344 "exec", RegExpExecJS, | 346 "exec", RegExpExecJS, |
| 345 "test", RegExpTest, | 347 "test", RegExpTest, |
| 346 "toString", RegExpToString, | 348 "toString", RegExpToString, |
| 347 "compile", RegExpCompileJS | 349 "compile", RegExpCompileJS |
| 348 ]); | 350 ]); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // Exports | 422 // Exports |
| 421 | 423 |
| 422 utils.Export(function(to) { | 424 utils.Export(function(to) { |
| 423 to.RegExpExec = DoRegExpExec; | 425 to.RegExpExec = DoRegExpExec; |
| 424 to.RegExpExecNoTests = RegExpExecNoTests; | 426 to.RegExpExecNoTests = RegExpExecNoTests; |
| 425 to.RegExpLastMatchInfo = RegExpLastMatchInfo; | 427 to.RegExpLastMatchInfo = RegExpLastMatchInfo; |
| 426 to.RegExpTest = RegExpTest; | 428 to.RegExpTest = RegExpTest; |
| 427 }); | 429 }); |
| 428 | 430 |
| 429 }) | 431 }) |
| OLD | NEW |