refactor: make some classes final for performance
This commit is contained in:
parent
1b87c2f5a6
commit
82d6f52a26
@ -7,7 +7,7 @@ import java.util.function.Supplier;
|
|||||||
|
|
||||||
import me.topchetoeu.jscript.runtime.exceptions.InterruptException;
|
import me.topchetoeu.jscript.runtime.exceptions.InterruptException;
|
||||||
|
|
||||||
public class Engine implements EventLoop {
|
public final class Engine implements EventLoop {
|
||||||
private static class Task<T> implements Comparable<Task<?>> {
|
private static class Task<T> implements Comparable<Task<?>> {
|
||||||
public final Supplier<?> runnable;
|
public final Supplier<?> runnable;
|
||||||
public final CompletableFuture<T> notifier = new CompletableFuture<T>();
|
public final CompletableFuture<T> notifier = new CompletableFuture<T>();
|
||||||
@ -74,7 +74,4 @@ public class Engine implements EventLoop {
|
|||||||
public boolean isRunning() {
|
public boolean isRunning() {
|
||||||
return this.thread != null;
|
return this.thread != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Engine() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import me.topchetoeu.jscript.runtime.values.functions.CodeFunction;
|
|||||||
import me.topchetoeu.jscript.runtime.values.objects.ObjectValue;
|
import me.topchetoeu.jscript.runtime.values.objects.ObjectValue;
|
||||||
import me.topchetoeu.jscript.runtime.values.objects.ScopeValue;
|
import me.topchetoeu.jscript.runtime.values.objects.ScopeValue;
|
||||||
|
|
||||||
public class Frame {
|
public final class Frame {
|
||||||
public static final Key<Frame> KEY = Key.of();
|
public static final Key<Frame> KEY = Key.of();
|
||||||
|
|
||||||
public static enum TryState {
|
public static enum TryState {
|
||||||
|
@ -5,7 +5,7 @@ import me.topchetoeu.jscript.runtime.values.primitives.NumberValue;
|
|||||||
import me.topchetoeu.jscript.runtime.values.primitives.StringValue;
|
import me.topchetoeu.jscript.runtime.values.primitives.StringValue;
|
||||||
import me.topchetoeu.jscript.runtime.values.primitives.SymbolValue;
|
import me.topchetoeu.jscript.runtime.values.primitives.SymbolValue;
|
||||||
|
|
||||||
public class KeyCache {
|
public final class KeyCache {
|
||||||
public final Value value;
|
public final Value value;
|
||||||
private Integer intCache;
|
private Integer intCache;
|
||||||
private Double doubleCache;
|
private Double doubleCache;
|
||||||
|
@ -5,7 +5,7 @@ import me.topchetoeu.jscript.common.environment.Environment;
|
|||||||
import me.topchetoeu.jscript.runtime.Frame;
|
import me.topchetoeu.jscript.runtime.Frame;
|
||||||
import me.topchetoeu.jscript.runtime.values.Value;
|
import me.topchetoeu.jscript.runtime.values.Value;
|
||||||
|
|
||||||
public class CodeFunction extends FunctionValue {
|
public final class CodeFunction extends FunctionValue {
|
||||||
public final FunctionBody body;
|
public final FunctionBody body;
|
||||||
public final Value[][] captures;
|
public final Value[][] captures;
|
||||||
public Environment env;
|
public Environment env;
|
||||||
|
@ -3,7 +3,7 @@ package me.topchetoeu.jscript.runtime.values.functions;
|
|||||||
import me.topchetoeu.jscript.common.environment.Environment;
|
import me.topchetoeu.jscript.common.environment.Environment;
|
||||||
import me.topchetoeu.jscript.runtime.values.Value;
|
import me.topchetoeu.jscript.runtime.values.Value;
|
||||||
|
|
||||||
public class NativeFunction extends FunctionValue {
|
public final class NativeFunction extends FunctionValue {
|
||||||
public static interface NativeFunctionRunner {
|
public static interface NativeFunctionRunner {
|
||||||
Value run(Arguments args);
|
Value run(Arguments args);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import me.topchetoeu.jscript.common.environment.Environment;
|
|||||||
import me.topchetoeu.jscript.runtime.values.Value;
|
import me.topchetoeu.jscript.runtime.values.Value;
|
||||||
import me.topchetoeu.jscript.runtime.values.Member.FieldMember;
|
import me.topchetoeu.jscript.runtime.values.Member.FieldMember;
|
||||||
|
|
||||||
public class ScopeValue extends ObjectValue {
|
public final class ScopeValue extends ObjectValue {
|
||||||
private class VariableField extends FieldMember {
|
private class VariableField extends FieldMember {
|
||||||
private int i;
|
private int i;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user