Author: [email protected]
Date: Tue Mar 31 02:02:40 2009
New Revision: 1645
Modified:
branches/bleeding_edge/src/codegen.cc
branches/bleeding_edge/src/compiler.cc
Log:
Use the AST optimizer on the bodies of function literals. Notify the
oprofile agent when we compile the body of a function literal.
Review URL: http://codereview.chromium.org/57048
Modified: branches/bleeding_edge/src/codegen.cc
==============================================================================
--- branches/bleeding_edge/src/codegen.cc (original)
+++ branches/bleeding_edge/src/codegen.cc Tue Mar 31 02:02:40 2009
@@ -1,4 +1,4 @@
-// Copyright 2007-2008 the V8 project authors. All rights reserved.
+// Copyright 2009 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -30,8 +30,10 @@
#include "bootstrapper.h"
#include "codegen-inl.h"
#include "debug.h"
+#include "oprofile-agent.h"
#include "prettyprinter.h"
#include "register-allocator-inl.h"
+#include "rewriter.h"
#include "runtime.h"
#include "scopeinfo.h"
#include "stub-cache.h"
@@ -264,6 +266,12 @@
if (FLAG_lazy && allow_lazy) {
code = ComputeLazyCompile(node->num_parameters());
} else {
+ // The bodies of function literals have not yet been visited by
+ // the AST optimizer/analyzer.
+ if (!Rewriter::Optimize(node)) {
+ return Handle<JSFunction>::null();
+ }
+
code = MakeCode(node, script_, false);
// Check for stack-overflow exception.
@@ -274,6 +282,12 @@
// Function compilation complete.
LOG(CodeCreateEvent("Function", *code, *node->name()));
+
+#ifdef ENABLE_OPROFILE_AGENT
+ OProfileAgent::CreateNativeCodeRegion(*node->name(),
+ code->address(),
+ code->ExecutableSize());
+#endif
}
// Create a boilerplate function.
Modified: branches/bleeding_edge/src/compiler.cc
==============================================================================
--- branches/bleeding_edge/src/compiler.cc (original)
+++ branches/bleeding_edge/src/compiler.cc Tue Mar 31 02:02:40 2009
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2009 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -32,10 +32,10 @@
#include "compilation-cache.h"
#include "compiler.h"
#include "debug.h"
-#include "scopes.h"
+#include "oprofile-agent.h"
#include "rewriter.h"
+#include "scopes.h"
#include "usage-analyzer.h"
-#include "oprofile-agent.h"
namespace v8 { namespace internal {
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---