Skip to content

Commit da5b745

Browse files
hashseedCommit Bot
authored andcommitted
[api] deprecate unused context size estimate.
Change-Id: I8de170892f061a8b30d1e39d1a7d3b4e2fe9230d Reviewed-on: https://chromium-review.googlesource.com/461823 Commit-Queue: Yang Guo <[email protected]> Reviewed-by: Jochen Eisinger <[email protected]> Cr-Commit-Position: refs/heads/master@{#44222}
1 parent ac67a8c commit da5b745

8 files changed

Lines changed: 2 additions & 200 deletions

File tree

BUILD.gn

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,8 +1380,6 @@ v8_source_set("v8_base") {
13801380
"src/compiler/wasm-linkage.cc",
13811381
"src/compiler/zone-stats.cc",
13821382
"src/compiler/zone-stats.h",
1383-
"src/context-measure.cc",
1384-
"src/context-measure.h",
13851383
"src/contexts-inl.h",
13861384
"src/contexts.cc",
13871385
"src/contexts.h",

include/v8.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8274,7 +8274,7 @@ class V8_EXPORT Context {
82748274
/**
82758275
* Estimate the memory in bytes retained by this context.
82768276
*/
8277-
size_t EstimatedSize();
8277+
V8_DEPRECATED("no longer supported", size_t EstimatedSize());
82788278

82798279
/**
82808280
* Stack-allocated class which sets the execution context for all

src/api.cc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "src/code-stubs.h"
3030
#include "src/compiler-dispatcher/compiler-dispatcher.h"
3131
#include "src/compiler.h"
32-
#include "src/context-measure.h"
3332
#include "src/contexts.h"
3433
#include "src/conversions-inl.h"
3534
#include "src/counters.h"
@@ -6506,12 +6505,7 @@ void Context::SetErrorMessageForCodeGenerationFromStrings(Local<String> error) {
65066505
context->set_error_message_for_code_gen_from_strings(*error_handle);
65076506
}
65086507

6509-
6510-
size_t Context::EstimatedSize() {
6511-
return static_cast<size_t>(
6512-
i::ContextMeasure(*Utils::OpenHandle(this)).Size());
6513-
}
6514-
6508+
size_t Context::EstimatedSize() { return 0; }
65156509

65166510
MaybeLocal<v8::Object> ObjectTemplate::NewInstance(Local<Context> context) {
65176511
PREPARE_FOR_EXECUTION(context, ObjectTemplate, NewInstance, Object);

src/context-measure.cc

Lines changed: 0 additions & 83 deletions
This file was deleted.

src/context-measure.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/v8.gyp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,6 @@
787787
'compiler-dispatcher/optimizing-compile-dispatcher.h',
788788
'compiler.cc',
789789
'compiler.h',
790-
'context-measure.cc',
791-
'context-measure.h',
792790
'contexts-inl.h',
793791
'contexts.cc',
794792
'contexts.h',

test/cctest/heap/test-heap.cc

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "src/assembler-inl.h"
3333
#include "src/code-stubs.h"
3434
#include "src/compilation-cache.h"
35-
#include "src/context-measure.h"
3635
#include "src/debug/debug.h"
3736
#include "src/deoptimizer.h"
3837
#include "src/elements.h"
@@ -5867,53 +5866,6 @@ TEST(RemoveCodeFromSharedFunctionInfoButNotFromClosure) {
58675866
"check(g1, g2);");
58685867
}
58695868

5870-
TEST(ContextMeasure) {
5871-
CcTest::InitializeVM();
5872-
v8::HandleScope scope(CcTest::isolate());
5873-
Isolate* isolate = CcTest::i_isolate();
5874-
LocalContext context;
5875-
5876-
int size_upper_limit = 0;
5877-
int count_upper_limit = 0;
5878-
HeapIterator it(CcTest::heap());
5879-
for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) {
5880-
size_upper_limit += obj->Size();
5881-
count_upper_limit++;
5882-
}
5883-
5884-
ContextMeasure measure(*isolate->native_context());
5885-
5886-
PrintF("Context size : %d bytes\n", measure.Size());
5887-
PrintF("Context object count: %d\n", measure.Count());
5888-
5889-
CHECK_LE(1000, measure.Count());
5890-
CHECK_LE(50000, measure.Size());
5891-
5892-
CHECK_LE(measure.Count(), count_upper_limit);
5893-
CHECK_LE(measure.Size(), size_upper_limit);
5894-
}
5895-
5896-
TEST(ContextMeasureNoMap) {
5897-
CcTest::InitializeVM();
5898-
v8::HandleScope scope(CcTest::isolate());
5899-
5900-
Local<v8::Context> current_context = CcTest::isolate()->GetCurrentContext();
5901-
Local<v8::Context> other_context = v8::Context::New(CcTest::isolate());
5902-
5903-
CompileRun(current_context, "var x = []");
5904-
5905-
size_t original_size_current = current_context->EstimatedSize();
5906-
size_t original_size_other = other_context->EstimatedSize();
5907-
5908-
CompileRun(current_context, "x.a = 1;");
5909-
5910-
size_t new_size_current = current_context->EstimatedSize();
5911-
size_t new_size_other = other_context->EstimatedSize();
5912-
5913-
CHECK_LT(original_size_current, new_size_current);
5914-
CHECK_EQ(original_size_other, new_size_other);
5915-
}
5916-
59175869
TEST(ScriptIterator) {
59185870
CcTest::InitializeVM();
59195871
v8::HandleScope scope(CcTest::isolate());

test/cctest/test-api.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25778,14 +25778,6 @@ TEST(FutexInterruption) {
2577825778
}
2577925779

2578025780

25781-
TEST(EstimatedContextSize) {
25782-
v8::Isolate* isolate = CcTest::isolate();
25783-
v8::HandleScope scope(isolate);
25784-
LocalContext env;
25785-
CHECK(50000 < env->EstimatedSize());
25786-
}
25787-
25788-
2578925781
static int nb_uncaught_exception_callback_calls = 0;
2579025782

2579125783

0 commit comments

Comments
 (0)