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

Unified Diff: runtime/vm/parser.cc

Issue 3003583002: [VM, Precompiler] PoC Obfuscator (Closed)
Patch Set: Fix bad refactoring in NewAtomicRename Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/parser.h ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index c7ee84e5214a821988dd74836764d49809f7e2cd..c66c01a5acfd1abac005eb10bc0f2a60a268c7d5 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -28,6 +28,7 @@
#include "vm/object.h"
#include "vm/object_store.h"
#include "vm/os.h"
+#include "vm/precompiler.h"
#include "vm/regexp_assembler.h"
#include "vm/resolver.h"
#include "vm/safepoint.h"
@@ -6273,6 +6274,10 @@ void Parser::ParseLibraryImportExport(const Object& tl_owner,
ConsumeToken();
pieces.Add(*ExpectIdentifier("identifier expected"), allocation_space_);
}
+ if (I->obfuscate()) {
+ // If we are obfuscating then we need to deobfuscate environment name.
+ Obfuscator::Deobfuscate(T, pieces);
+ }
AstNode* valueNode = NULL;
if (CurrentToken() == Token::kEQ) {
ConsumeToken();
@@ -12651,7 +12656,8 @@ RawObject* Parser::EvaluateConstConstructorCall(
const Class& type_class,
const TypeArguments& type_arguments,
const Function& constructor,
- ArgumentListNode* arguments) {
+ ArgumentListNode* arguments,
+ bool obfuscate_symbol_instances /* = true */) {
NoReloadScope no_reload_scope(isolate(), thread());
NoOOBMessageScope no_msg_scope(thread());
// Factories and constructors are not generic functions.
@@ -12706,6 +12712,10 @@ RawObject* Parser::EvaluateConstConstructorCall(
// The factory method returns the allocated object.
instance ^= result.raw();
}
+ if (obfuscate_symbol_instances && I->obfuscate() &&
+ (instance.clazz() == I->object_store()->symbol_class())) {
+ Obfuscator::ObfuscateSymbolInstance(T, instance);
+ }
return TryCanonicalize(instance, TokenPos());
}
}
@@ -13768,9 +13778,10 @@ AstNode* Parser::ParseSymbolLiteral() {
const Function& constr = Function::ZoneHandle(
Z, symbol_class.LookupConstructor(Symbols::SymbolCtor()));
ASSERT(!constr.IsNull());
- const Object& result = Object::Handle(
- Z, EvaluateConstConstructorCall(symbol_class, TypeArguments::Handle(Z),
- constr, constr_args));
+ const Object& result =
+ Object::Handle(Z, EvaluateConstConstructorCall(
+ symbol_class, TypeArguments::Handle(Z), constr,
+ constr_args, /*obfuscate_symbol_instances=*/false));
if (result.IsUnhandledException()) {
ReportErrors(Error::Cast(result), script_, symbol_pos,
"error executing const Symbol constructor");
« no previous file with comments | « runtime/vm/parser.h ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698